Author tim.golden
Recipients sandberg, tim.golden
Date 2009-03-13.20:20:02
SpamBayes Score 9.44067e-12
Marked as misclassified No
Message-id <49BABFED.5050800@timgolden.me.uk>
In-reply-to <1236974616.85.0.793858181991.issue5484@psf.upfronthosting.co.za>
Content
Erik Sandberg wrote:
> Erik Sandberg <sandberg@virtutech.com> added the comment:
> 
> Did you test your code? 

Several times, cutting and pasting into the Python interpreter.
But I missed the fact that you were running Python 2.5

Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC
Type "help", "copyright", "credits" or "license" for m
>>> import subprocess
>>> open ("t(o.bat", "w").write ("echo we are here\n")
>>> subprocess.call (["t(o.bat"])

c:\temp>echo we are here
we are here
0
>>>

Testing under 2.5 shows the issue you describe

However, I doubt very much whether any change would be
made to 2.5 at this point anyway: I think it's in
security-bug-fix-only  mode now. Bizarrely, I can't
see any reason why the behaviour should have changed.
Might even be the runtime it links to.

> (this guess is based on what I read in msdn.com's docs on CreateProcess:
> """To run a batch file, you must start the command interpreter; set
> lpApplicationName to cmd.exe and set lpCommandLine to the following
> arguments: /c plus the name of the batch file.""")

In fact, the shell=True code on Windows basically does:

%COMSPEC% /c args... 

for you behind the scenes. But, as my example above shows,
you don't seem to need to do that in any case.

TJG
History
Date User Action Args
2009-03-13 20:20:06tim.goldensetrecipients: + tim.golden, sandberg
2009-03-13 20:20:03tim.goldenlinkissue5484 messages
2009-03-13 20:20:02tim.goldencreate