Quoth Thomas Duterme <thomas at madeforchina.com>: | This may sound silly, but I have a question on os.system(). | | Let's say I have a script while calls some program XXX via | os.system(). Will python wait for XXX to finish what its Yes. | ... but what if I wanted | python to just mosey on down while launching a | subprocess...(ie not wait) How would this be done? Where you're invoking another program, you can use the os.spawnv() function or one of its relatives in both cases. >>> print os.spawnv.__doc__ spawnv(mode, file, args) -> integer Execute file with arguments from args in a subprocess. If mode == P_NOWAIT return the pid of the process. If mode == P_WAIT return the process's exit code if it exits normally; otherwise return -SIG, where SIG is the signal that killed it. That's better not only because you can get what you're asking for, but also because the value of args is passed directly to the program instead of having to be interpreted by a shell, as in os.system(). That interpretation step is not so terribly expensive, but it's vulnerable to terrible errors if the data may contain shell metacharacters. Donn Cave, donn at oz.net
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4