我正在尝试修复在 Apache2 上使用 mod_fcgid 运行 Trac 0.11 时遇到的以下异常:
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 我看到“socket”是一个类,应该有一个名为“error”的成员,那么为什么会出现这个异常呢?
我通常在编写 C 或 Java 代码并且从未在 Python 中做过任何事情,有人可以启发我吗?:)
谢谢,
猞猁