Author tesla
Recipients tesla
Date 2009-08-24.08:36:03
SpamBayes Score 1.83742e-14
Marked as misclassified No
Message-id <1251102965.83.0.35212908562.issue6773@psf.upfronthosting.co.za>
In-reply-to
Content
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())
History
Date User Action Args
2009-08-24 08:36:05teslasetrecipients: + tesla
2009-08-24 08:36:05teslasetmessageid: <1251102965.83.0.35212908562.issue6773@psf.upfronthosting.co.za>
2009-08-24 08:36:04teslalinkissue6773 messages
2009-08-24 08:36:03teslacreate