1

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?

2 Answers 2

1

Completely removing the process from supervisor and re-adding fixed it (apparently reread wasn't pulling the changes properly?)

If you have a better explanation, please post.

Sign up to request clarification or add additional context in comments.

1 Comment

I couldn't manage to update PATH using evironment either but I came across with a solution in this question: stackoverflow.com/questions/7191613/… HTH
1

Elaborating on @ShaneReustle's answer I had to run these commands:

$ supervisorctl shutdown
$ supervisord

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.