[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

Paul Morelle report at bugs.python.org
Thu Apr 9 17:54:20 CEST 2009


Paul Morelle <madprog at htkc.org> added the comment:

Hello, I can reproduce the bug on a Windows XP Professional, SP 3, with
three versions of Python:

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on
win32
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32

I can have this error code with the following code:

===================================================
import struct, subprocess

command = 'C:\\WINDOWS\\NOTEPAD.EXE'
env     = {'FOO': 'bar'}
p = subprocess.Popen(command, env=env)

p.wait()

err = struct.unpack('I', struct.pack('i', p.returncode))[0]
print '%x (%d)'%(err, err)
===================================================

The output is "c0150004 (3222601732)" with the three versions

If the `env' variable is set to None before the creation of the Popen
object, then Notepad.exe is launched correctly.

So, it is not only the python interpreter that fails with this call, it
would be the call to CreateProcess in the subprocess module that would
be incorrect…

Any hint?

----------
nosy: +madprog
title: Starting Python as a subprocess fails when subprocess.Popen has env argument -> Starting any program as a subprocess fails when subprocess.Popen has env argument
Added file: http://bugs.python.org/file13663/fail2.py

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


More information about the Python-bugs-list mailing list