Quoting Peter Astrand <astrand at lysator.liu.se>: > >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", > "line"]) > > > > 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. Cheers, Nick. -- Nick Coghlan Brisbane, Australia
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