开发者

Running a long running process via Python Popen

So, I thought it would be cool if i could get my dev env up and running in a single fell swoop with some python magic. Various DBs, webserver etc.

However, every variation on the below that i have tried on the following seems to fail with 'file not found'.

p2 = Popen(["exec", "/path/to/redis/server"], stdin=p1.stdout, stdout=PIPE) 
output = p2.communicate()[0]

Running the command directly from the shel开发者_Go百科l (i.e. exec /path/to/redis/server) works just fine. Strangely enough, a simple command line uptime seems to work fine.

Any clues as to what is going on? Also, whilst we are on the topic, is multiprocessing the thing to use when i want to run many of these external processes in parallel?

Thanks


exec is a builtin command in bash, not an executable. The file not found error probably comes from exec not being found in the $PATH.

I would try ommitting "exec" in the Popen call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜