5
我只是學習在Twisted上編寫應用程序,所以犯了很多錯誤。扭曲的,延遲的完全回溯
假設有一個代碼:
d = defer.Deferred()
d.addCallback(self.start_app)
#d.addErrback(self.command_die)
d.callback(0)
def start_app(self, d):
#import os
return os.startfile(self.path)
def command_die(self, d):
print ('com_die', d)
我們在os.startfile(self.path)錯誤和大回溯:
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 542, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "C:/Dropbox/my_py/client3.py", line 100, in command_analiz
d.callback(i)
File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 361, in callback
self._startRunCallbacks(result)
File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 455, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File "C:\Python27\lib\site-packages\twisted\internet\defer.py", line 542, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "C:/Dropbox/my_py/client3.py", line 353, in start_eve_d
return os.startfile(self.path)
exceptions.NameError: global name 'os' is not defined
如果我取消#d.addErrback(自我。 command_die)
我們有一點 「登錄」 通過印刷( 'com_die' 創建,d):
('com_die', <twisted.python.failure.Failure <type 'exceptions.NameError'>>)
有沒有辦法在設計時獲得完整的Log \ TraceBack?
此刻我明白,那裏有一個新的錯誤,有必要作出評論addErrorback單曲