【发布时间】:2012-04-16 20:53:39
【问题描述】:
您好,我正在尝试在 python 中执行小代码,它给出了操作系统错误。
>>> import os
>>> def child():
... pid = os.fork()
... if not pid:
... for i in range(5):
... print i
... return os.wait()
...
>>> child()
0
1
2
3
4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 6, in child
OSError: [Errno 10] No child processes
我无法弄清楚为什么它会给出 OSError。我用谷歌搜索它,它被记录为 python 2.6 或更早版本的错误。我正在使用python2.7。
【问题讨论】:
-
你好,这是 ubuntu-server 版本
标签: python operating-system fork