get pid of a nohup command in Python

g.willgoose at telluricresearch.com g.willgoose at telluricresearch.com
Mon Feb 12 23:52:57 EST 2007


I'm new to Python and am evaluating moving a project from Tcl/Tk to
Python and am stuck on one issue. How can I nohup (or any detached
task for that matter) a process and get its PID in Python. The obvious
route of (with a trivial example)

os.system("nohup ls > junk &")

returns the status of the command execution (ie. 0). I wish to get the
PID output of the command (e.g. 16617). All the other commands spawn**
also seem to return the execution status not the PID. This is a
showstopper so any help appreciated.




More information about the Python-list mailing list