您的位置:首页 > 编程语言 > Python开发

Python IDLE模式下采用multiprocessing 子进程无法输出

2012-07-19 10:44 585 查看
参考资料:http://stackoverflow.com/questions/2774585/child-processes-created-with-python-multiprocessing-module-wont-print


Well, IDLE is a strange thing. In order to "capture" everything what you write using
print
statements or
sys.stdout.write
, IDLE "overrides"
sys.stdout
and replaces it with an object that passes everything back to IDLE so it can print it. I guess when you are starting a new process from
multiprocessing
, this hackery is not inherited by the child process, therefore you don't see anything in IDLE. But I'm just guessing here, I don't have a Windows machine at the moment to check it. – Tamás May 6 '10 at 9:10



也就是说由于Windows安全机制以及IDLE设计的问题,这个没办法搞定,只能在命令行模式下运行正常。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: