【发布时间】:2015-01-07 08:38:35
【问题描述】:
我最近升级到优胜美地。一些以前在 Mavericks 上运行的 Python 脚本也挂了。我的版本是 2.7.8。我创建了一个测试用例:
import subprocess
cat = subprocess.Popen(['top', '-l', '1'],
stdout=subprocess.PIPE,
)
cat.wait()
在 Maveric 上运行,但在 Yosemite 上挂起。当我在优胜美地打断时,我看到了以下回溯。
Traceback (most recent call last):
File "test.py", line 5, in <module>
cat.wait()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1376, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
return func(*args)
KeyboardInterrupt
关于我做错了什么的任何提示?
【问题讨论】:
-
执行
['top', '-l', '1', '-n', '0']之类的操作并检查是否可行。这可能意味着指向@GoBusto 的死锁是正确的。
标签: python-2.7 subprocess osx-yosemite