KevinOelen
KevinOelen

Reputation: 779

supervisord python import error

I'm trying to daemonize my bash script which starts running python script inside.

Here is my program section of supervisord.conf

[program:source]
directory=/home/vagrant/
command=/usr/local/bin/python /home/vagrant/start.py
process_name=%(program_name)s
user=vagrant
autostart=true

When I start supervisord it doesn't work. From the log i receive:

No module named monitor.tasks

When I run the program directly it works. Seems it has working directory issue but I don't know how to solve. Any suggestion?

Upvotes: 0

Views: 2133

Answers (2)

LucasR
LucasR

Reputation: 21

I had a similar problem, but mine was related with the PYTHONPATH. All I had to do was adding a single line on my program configuration:

[program:myProgram]
environment=PYTHONPATH=/home/nectu/.local/lib/python3.6/site-packages
(...)

Running on: Lubuntu 18.04 / Python 3.6

Upvotes: 2

KevinOelen
KevinOelen

Reputation: 779

Found where my mistake was. I just had to use -m after python command as follows:

command=/usr/local/bin/python -m vagrant/start.py

Upvotes: 1

Related Questions