This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess issue on Win 7 x64
Type: behavior Stage:
Components: Library (Lib), Windows Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, tesla
Priority: normal Keywords:

Created on 2009-08-24 08:36 by tesla, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Win7RCx64.jpg tesla, 2009-08-24 08:36 Screenshot of message box with error.
issue6773.py ezio.melotti, 2009-10-07 08:24
Messages (3)
msg91910 - (view) Author: Piotr Foltyn (tesla) Date: 2009-08-24 08:36
The sample code presented below produces error (screenshot available in 
attachment) on Windows 7 RC x64 with latest version of Python 2.6 
installed. Both 32bit and 64bit versions of Python 2.6 are affected by 
this issue. Python 3 executes this code flawlessly.
The problem seems to be related to stdout redirection. If the "stdout = 
PIPE" is omitted in the first statement of main() function, code 
executes properly but we don't have access to the processes output. If 
the line "Popen(["dir"], stdout = PIPE, shell = True)" is changed to 
"sin, sout = os.popen2(["dir"])" and os module is imported everything 
works fine. It doesn't matter what command is executed ("dir", "bcedit", 
"mspaint" etc)


import sys
from subprocess import Popen, PIPE
from multiprocessing import Process

def myProcess():
    Popen(["dir"], shell = True) # ERROR :(

def main():
    Popen(["dir"], stdout = PIPE, shell = True)
    Process(target = myProcess).start()
    return 0

if __name__ == "__main__":
    sys.exit(main())
msg93681 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-10-07 08:24
I cannot reproduce it on Win7 32bit (OS Name: Microsoft Windows 7
Enterprise; OS Version: 6.1.7600 N/A Build 7600) with Python 2.6.3rc1.
Attached there's the file I used (a slightly different version of what
you posted, your version worked too), this is the output I got:

cmd>python issue6773.py
"hello from myProcess"

cmd>
msg93689 - (view) Author: Piotr Foltyn (tesla) Date: 2009-10-07 10:18
I cannot reproduce it on Windows 7 x64 Ultimate either.
sys.getwindowsversion() -> (6, 1, 7600, 2, '')

Probably this bug was in Win7 RC and not in python. Thanks for your time. 
Closing.
History
Date User Action Args
2022-04-11 14:56:52adminsetgithub: 51022
2009-10-07 10:18:29teslasetstatus: open -> closed

messages: + msg93689
2009-10-07 08:24:20ezio.melottisetfiles: + issue6773.py
priority: normal

nosy: + ezio.melotti
messages: + msg93681
2009-08-24 08:36:04teslacreate