Is there a way to connect to the X server from the .sh script? I tried
#!/bin/bash
export DISPLAY=:1
BASEDIR=`dirname "${0}"`
cd "$BASEDIR"
python_header.py
but no luck.
Just an update for those who might have the same problem: The following link
http://www.thegeekstuff.com/2010/06/xhost-cannot-open-display/
and then adding this to my code:
export DISPLAY=:0.0
solved the problem