I am using a supervisor to run a python script:
[program:twitter_track] autorestart = true numprocs = 1 autostart = false redirect_stderr = True stopwaitsecs = 1 startsecs = 1 priority = 99 command = python /home/ubuntu/services/twitter.py track startretries = 3 stdout_logfile = /home/ubuntu/logs/twitter_track.log
But the process does not start. Here's what the error log says:
Traceback (most recent call last): File "/home/ubuntu/services/twitter.py", line 6, in <module> from mymodule.twitter.stream import TwitterStream ImportError: No module named mymodule.twitter.stream Traceback (most recent call last): File "/home/ubuntu/services/twitter.py", line 6, in <module>
It seems to get mymodule, but if I run twitter.py on my own, everything will work fine, it only throws this error when I run it through the supervisor.
I added mymodule in PYTHONPATH to my ~ / .profile file, for example:
export PYTHONPATH=$PYTHONPATH:/home/ubuntu/lib
Is there a reason why the script will work when launched through the terminal, but not when launched through the dispatcher? Any help would be appreciated.
supervisord
Hanpan
source share