[New-bugs-announce] [issue3440] Starting Python as a subprocess fails when subprocess.Popen has env argument

Lenard Lindstrom report at bugs.python.org
Thu Jul 24 22:58:55 CEST 2008


New submission from Lenard Lindstrom <len-l at telus.net>:

Python 2.6b2 (r26b2:65106, Jul 18 2008, 18:22:27) [MSC v.1500 32 bit
(Intel)] on win32

Windows XP Professional, SP 2

Library class subprocess.Popen


When subprocess.Popen is used to start the python interpreter as a
subprocess with a custom environment, env is set to a mapping, the
subprocess terminates with the following pop-up error dialog:

"The application failed to initialize properly (0xc0150004). Click on OK
to terminate the application."

The attached fail.py program reproduces the bug. It should print "ABCDE"
if successful. It does for Pythons 2.4 and 2.5.

The reason is that Python 2.6 on Windows requires the environment
variable SystemRoot, which it cannot find. This is demonstrated by
modifying fail.py to include SystemRoot in the environment. This works:

import sys
import os
import subprocess

command = ('''%s -c "import os; print os.environ['YAHOO']"''' %
           sys.executable)

env = {"YAHOO": "ABCDE", "SystemRoot": os.environ["SystemRoot"]}
subprocess.Popen(command, env=env).wait()

----------
components: Library (Lib), Windows
files: fail.py
messages: 70225
nosy: kermode
severity: normal
status: open
title: Starting Python as a subprocess fails when subprocess.Popen has env argument
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file10970/fail.py

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


More information about the New-bugs-announce mailing list