Message91910
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()) |
|
Date |
User |
Action |
Args |
2009-08-24 08:36:05 | tesla | set | recipients:
+ tesla |
2009-08-24 08:36:05 | tesla | set | messageid: <1251102965.83.0.35212908562.issue6773@psf.upfronthosting.co.za> |
2009-08-24 08:36:04 | tesla | link | issue6773 messages |
2009-08-24 08:36:03 | tesla | create | |
|