Tôi thấy điều này khi tôi nhấn Ctrl-C để thoát khỏi ứng dụng của tôiPython Đa lối ra lỗi
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.6/multiprocessing/util.py", line 269, in _exit_function
p.join()
File "/usr/lib/python2.6/multiprocessing/process.py", line 119, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 117, in wait
return self.poll(0)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 106, in poll
pid, sts = os.waitpid(self.pid, flag)
OSError: [Errno 4] Interrupted system call
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.6/multiprocessing/util.py", line 269, in _exit_function
p.join()
File "/usr/lib/python2.6/multiprocessing/process.py", line 119, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 117, in wait
return self.poll(0)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 106, in poll
pid, sts = os.waitpid(self.pid, flag)
OSError: [Errno 4] Interrupted system call
Tôi đang sử dụng xoắn trên đầu trang của những thứ của riêng tôi,
Tôi đã đăng ký tín hiệu Ctrl-C với đoạn mã sau
def sigHandler(self, arg1, arg2):
if not self.backuped:
self.stopAll()
else:
out('central', 'backuped ALREADY, now FORCE exiting')
exit()
def stopAll(self):
self.parserM.shutdown()
for each in self.crawlM:
each.shutdown()
self.backup()
reactor.stop()
và khi họ tín hiệu khác để tắt máy, nó sẽ cố gắng để nói với họ để tắt máy độc đáo qua
exit = multiprocessing.Event()
def shutdown(self):
self.exit.set()
nơi mà tất cả các quá trình của tôi là trong một số hình thức,
def run(self):
while not self.exit.is_set():
do something
out('crawler', 'crawler exited sucessfully')
Bất kỳ ý tưởng gì lỗi này là gì? Tôi chỉ nhận được nó khi tôi có nhiều hơn một ví dụ của một chủ đề cụ thể.
wow thực sự tuyệt vời. Bất kỳ tài nguyên trực tuyến tốt nào sẽ giải thích điều gì đó đến độ sâu như vậy? –