Quoting Peter Astrand email@example.com:
Your examples don't work with call either, right?
They work with call if you use a string argument. That's the core of the problem: The callv function doesn't support passing a string-type args argument to the Popen constructor.
Their call() equivalents:
subprocess.call(["somewindowsprog.exe some strange command line"]) subprocess.call(["somewindowsprog.exe", "some", "strange", "command",
are just as broken, no?
Yes. You'll need to do:
subprocess.call("somewindowsprog.exe some strange command line")
Given that call is only a shortcut function, wouldn't the following suffice?:
def call(*args, **kwds): if len(args) <= 1: return Popen(*args, **kwds) else: return Popen(args, **kwds)
With that implementation, a single string, a list, a sequence of strings and Popen keywords only would all work as arguments to call. That is:
call("ls -l") -> Popen("ls -l") call("ls", "-l") -> Popen(["ls", "-l"]) call(["ls", "-l"]) -> Popen(["ls", "-l"]) call(args="ls -l") -> Popen(args="ls -l")
All it would mean is that if you want to use the optional arguments to Popen, you either don't use call, or you use keywords.