Subprocess or Process or OMG!!
Robert Kern
robert.kern at gmail.com
Thu May 18 19:14:36 EDT 2006
rh0dium wrote:
> Needless to say this is much more complex than what I was "hoping" for.
> Has anyone solved this in a generic approach..
>
> #!/usr/bin/env python
>
> import os,sys,string
> import subprocess
>
> argc = len(sys.argv)
>
> # Yes I move all exe's to the .bin direcotory
> sys.argv[0]=os.path.join(os.getcwd() + "/.bin/" +
> os.path.basename(sys.argv[0]))
>
> cmd = string.join(sys.argv," ")
> subprocess.Popen( cmd )
>
> This has several problems - least of which args aren't working.... Has
> anyone really tried this approach?
Did you read the documentation? It explains how to pass the command line (hint:
it's a list, not a string).
http://docs.python.org/lib/module-subprocess.html
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list