0
我試圖解決以下異常,我得到,而與mod_fcgid上運行的Apache2 Trac的0.11:蟒蛇2.6:socket.error(固定的Trac)
Unhandled exception in thread started by <bound method Connection.run of <trac.web._fcgi.Connection object at 0x88b5fec>>
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/trac/web/_fcgi.py", line 661, in run
except socket.error, e:
AttributeError: 'NoneType' object has no attribute 'error'
我修改了有關塊_fcgi.py到鎖是這樣的:
def run(self):
"""Begin processing data from the socket."""
self._keepGoing = True
while self._keepGoing:
try:
self.process_input()
except EOFError:
break
except socket.error, e:
if e[0] == errno.EBADF:
break
raise
except select.error, e:
if e[0] == errno.EBADF: # Socket was closed by Request.
break
raise
self._cleanupSocket()
導致異常的行爲except socket.error, e:
。閱讀Pydocs我看到'套接字'是一個類,應該有一個名爲'錯誤'的成員,爲什麼這個異常?
我通常編碼C或Java,從來沒有在Python做過什麼,有人可以啓發我嗎? :)
感謝,
lynix
我照你說的做了,把導入改爲'socketLib'。此錯誤現在發生在socketLib中: ,除了socketLib.error,e: AttributeError:'NoneType'對象沒有屬性'錯誤' – lynix