multi-threaded *nix program needs to spawn an external program/script
Donn Cave
donn at u.washington.edu
Wed Feb 6 19:49:19 EST 2002
Quoth "Jason Orendorff" <jason at jorendorff.com>:
| arbalt at yahoo.com wrote:
| > Would it make sense to add a function to python for *nix systems
| > that would do the "start an executable file as a new process"?
|
| Try os.spawnv(); it should work for both Unix and Windows.
| http://www.python.org/doc/current/lib/os-process.html
Yes, though according to him, that shouldn't work - he says, on Solaris,
in a threaded program, you mustn't "do anything" between fork and exec,
and fork and exec called separately from Python don't work for him for
that reason. os.spawnv is implemented in Python.
I think it would be worth a try. I think os.spawnv will work as well
as os.system.
The next step would be to recode os.spawnve in a C module. I don't know
anything about this Solaris problem, but if he's right, that would help.
(But then what's wrong with os.system?)
Of course if there's a system or thread library function that addresses
this need, that would obviously be the way to go.
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list