multi-threaded *nix program needs to spawn an external program/script
donn at u.washington.edu
Thu Feb 7 01:49:19 CET 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.
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
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