I have the following Supervisor config
[program:do_thing]
command = python -u stuff/do_thing.py
directory = /home/ubuntu/code/processing
environment = PYTHONPATH="$PYTHONPATH:/home/ubuntu/code/utils/"
stdout_logfile = /mnt/log/do_thing.log
redirect_stderr = true
The problem is /home/ubuntu/code/utils/ is not being included my PYTHONPATH according to sys.path (and I can't import modules from there). Sys.path shows all of the proper paths, except for this additional one. I've tried adding it to the .bashrc of both myself and the root user, but they aren't getting picked up by supervisor.
What am I doing wrong for supervisor to not be updating the environment variable properly? Do you need more info? Thanks!
Something I noticed as well: In the ubuntu user, sys.path is
['', '/home/ubuntu/code/processing', '/home/ubuntu/code/utils', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7']
When called inside supervisor, it is:
['/home/ubuntu/code/processing/stuff', '/', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7']
Notice how in the supervisor sys.path there is a '/' entry? Where did that come from?