使用了pypiwin32 包中的pythoncom的时候,当跑在apache下,日志报错:
[Thu Aug 27 17:06:44 2015] [error] [client 127.0.0.1] import pywintypes
[Thu Aug 27 17:06:44 2015] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 124, in <module>
[Thu Aug 27 17:06:44 2015] [error] [client 127.0.0.1] __import_pywin32_system_module__("pywintypes", globals())
[Thu Aug 27 17:06:44 2015] [error] [client 127.0.0.1] File "C:\\Python27\\lib\\site-packages\\win32\\lib\\pywintypes.py", line 114, in __import_pywin32_system_module__
[Thu Aug 27 17:06:44 2015] [error] [client 127.0.0.1] assert sys.modules[modname] is old_mod
[Thu Aug 27 17:06:44 2015] [error] [client 127.0.0.1] AssertionError
解决方案:
Temporary solution is comment out two lines in win32/lib/pywintypes.py: if sys.version_info < (3,0): #注释掉下面两行就ok了,不要忘记pass!!!!! #assert sys.modules[modname] is old_mod #assert mod is old_mod pass else: assert sys.modules[modname] is not old_mod assert sys.modules[modname] is mod # as above - re-reset to the *old* module object then update globs. sys.modules[modname] = old_mod globs.update(mod.__dict__)
时间: 2024-10-17 11:13:31