When using the pythoncom in the pypiwin32 package, when running under Apache, the log error:
[Thu 27 17:06:44 2015] [ERROR] [Client 127.0.0.1] Import pywintypes
[Thu 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 27 17:06:44 2015] [ERROR] [Client 127.0.0.1] __import_pywin32_system_module__ ("Pywintypes", Globals ())
[Thu 27 17:06:44 2015] [ERROR] [Client 127.0.0.1] File "c:\\python27\\lib\\site-packages\\win32\\lib\\pywintypes.py", line, in __import_pywin32_system_module__
[Thu 27 17:06:44 2015] [ERROR] [Client 127.0.0.1] assert Sys.modules[modname] is Old_mod
[Thu 27 17:06:44 2015] [ERROR] [Client 127.0.0.1] Assertionerror
Solution:
Temporary solution is comment out both lines in Win32/lib/pywintypes.py:if Sys.version_info < (3,0): #注释掉下面两行就ok了, no To forget the PASS!!!!! #assert Sys.modules[modname] is old_mod #assert mod are old_mod passelse: 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__)
Assert Sys.modules[modname] is Old_mod