D
D
darke3v2013-12-11 16:52:26
linux
darke3v, 2013-12-11 16:52:26

How to start a python process in linux?

Good day, it became necessary to run the script in a function using

subprocess.Popen("path/python.py %s" % stats.id,
                             shell=True, stdout=subprocess.PIPE)

However, in Linux there is such a problem, until the script finishes its work, the function hangs.
I would like to run the script in the background.
Z.s. python 2.7

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Artem, 2013-12-11
@darke3v

try this:
subprocess.Popen("path/python.py %s & " % stats.id,
shell=True, stdout=subprocess.PIPE)

D
darke3v, 2013-12-11
@darke3v

Excellent! Do not take it for impudence, but where can I read more about such nuances?

M
MagNet, 2013-12-13
@MagNet

subprocess.Popen(["path/python.py", stats.id])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question