[issue5484] subprocess.call() fails for .bat files on Windows, if executable path contains parenthesis

Tim Golden report at bugs.python.org
Fri Mar 13 19:29:41 CET 2009


Tim Golden <mail at timgolden.me.uk> added the comment:

Erik Sandberg wrote:
> Erik Sandberg <sandberg at virtutech.com> added the comment:
> 
> I experimented further, the only way to run a .bat file whose name
> contains funny characters, seems to be:
> 
> subprocess.call('""f(o.bat""', shell=True)

Well there's a bit of a double-whammy going on here. There's
a long-unfixed bug which doesn't quote parameters to
subprocess under Windows when shell=True:

  http://bugs.python.org/issue2304

but in fact you don't need to set shell=True to run a batch
file anyway:

import subprocess
open ("t(o.bat", "w").write ("echo we are here\n")
subprocess.call (["t(o.bat"])

----------
nosy: +tim.golden

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5484>
_______________________________________


More information about the Python-bugs-list mailing list