View Single Post
Posts: 27 | Thanked: 8 times | Joined on Jan 2009 @ Singapore
#3
thanks for your kindly reply.
following is the folder structure:
Code:
krank-07/
    krank
    src/
        Main.py
        Level.py
    levels/
        __init__.py
original krank code as follow
Code:
#!/bin/sh
KRANKPATH=`dirname $0`
PYTHONPATH=$KRANKPATH:$PYTHONPATH
export PYTHONPATH
python $KRANKPATH/src/Main.py
now I change it to
Code:
#!/bin/sh
KRANKPATH=$( (cd -P $(dirname $0) && pwd) )
PYTHONPATH=/home/ubuntu/krank-07:/home/ubuntu/krank-07/levels
export PYTHONPATH
echo $PYTHONPATH
sudo nohup python $KRANKPATH/src/Main.py &
"sudo nohup python $KRANKPATH/src/Main.py &" is added because I want to see the log and make script run background otherwise the program will hang and I have to force quit.

I set PYTHONPATH to /home/ubuntu/krank-07 where Main.py stays. so you suggest to add /home/ubuntu/krank-07/levels in PYTHONPATH?

Last edited by pigling; 2011-01-21 at 06:28.