Assert Sys.modules[modname] is Old_mod

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.