Answer the question
In order to leave comments, you need to log in
What happens in uWSGI with subprocess.Popen?
Can you please explain to me what is happening in my application running via uWSGI when I try to do subprocess.Popen
?
There is one subtlety - I use gevent and in uWSGI I use the built-in ability to work with gevent.
from gevent.subprocess import Popen, PIPE
import sys
def my_view(request, *args, **kwargs):
sub = Popen(sys.executable + ' my_worker.py args', stdout=PIPE, shell=True)
out, err = sub.communicate()
return out
unable to load configuration from my_worker.py
Answer the question
In order to leave comments, you need to log in
The problem was that when you run the application from uWSGI, sys.executable
the path lies not to the Python interpreter, but to the uwsgi-core binary.
Thanks to Pavel Denisov and sim3x for their help!
Being a hereditary telepath, I will assume that you make imports in the my_worker.py file that lead to the launch of the built-in flask web server. The idiomatic “if __name__ == '__main__':” is missing somewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question