When running Apache+Mod Python (Python 2.4), I was getting this error -
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] Traceback (most recent call last):
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "C:\\Python24\\Lib\\site-packages\\mod_python\\importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "C:\\Python24\\Lib\\site-packages\\mod_python\\importer.py", line 1229, in _process_target\n result = _execute_target(config, req, object, arg)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "C:\\Python24\\Lib\\site-packages\\mod_python\\importer.py", line 1128, in _execute_target\n result = object(arg)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\core\\handlers\\modpython.py", line 228, in handler\n return ModPythonHandler()(req)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\core\\handlers\\modpython.py", line 201, in __call__\n response = self.get_response(request)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\core\\handlers\\base.py", line 73, in get_response\n response = middleware_method(request)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\contrib\\sessions\\middleware.py", line 10, in process_request\n engine = import_module(settings.SESSION_ENGINE)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\utils\\importlib.py", line 35, in import_module\n __import__(name)
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\contrib\\sessions\\backends\\db.py", line 2, in ?\n from django.contrib.sessions.models import Session
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\contrib\\sessions\\models.py", line 4, in ?\n from django.db import models
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\db\\models\\__init__.py", line 12, in ?\n from django.db.models.fields.files import FileField, ImageField
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\db\\models\\fields\\files.py", line 8, in ?\n from django.core.files.storage import default_storage
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\core\\files\\storage.py", line 7, in ?\n from django.core.files import locks, File
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "c:\\python24\\Lib\\site-packages\\django\\core\\files\\locks.py", line 25, in ?\n import pywintypes
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "C:\\Python24\\Lib\\site-packages\\win32\\lib\\pywintypes.py", line 124, in ?\n __import_pywin32_system_module__("pywintypes", globals())
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] File "C:\\Python24\\Lib\\site-packages\\win32\\lib\\pywintypes.py", line 114, in __import_pywin32_system_module__\n assert sys.modules[modname] is old_mod
[Mon Nov 30 15:13:50 2009] [error] [client 127.0.0.1] AssertionError
With PythonDebug = On, assert took effect. I removed it and it worked without any issues.
I found that another user - <a href="http://markmail.org/message/hqnf6obaillzspxj#query:assert%20sys.modules[modname]%20is%20old_mod+page:1+mid:nahkqunchycwqtd4+state:results">here</a> also has the same issue.
He solved it by going back a version.
My concern is that assertion may be indicating pywintypesxx.dll has been loaded twice by the process, causing subtle problems with the types. It would be interesting to know what the __file__ attribute is on the 2 objects.
I have just come across this problem. I am using Apache 2.2, Django 1.1, Python 2.6.2 and mod_wsgi (mod_wsgi-win32-ap22py26-2.5.so) on Win XP Pro (SP3). It allworked fine until PayPal POSTed a notification. This was , of course, from a different IP address from the previous GETs and POSTs. It caused the above error. After I read this bug report I simple commented out the two Assert statements and it then seemed to work OK.
I did do a debug dump from pywintypes just before the assert statements just using the python unicode() function on the two modules (old_mod and mod) and they looked the same from that.
Changing back to the older version as reported above did not help.
Cheers
Steve McCusker
I "got this working" by just commenting out the 2 asserts and replacing them with a 'pass'
I put some debugs in, it seems that the same module is being used, but different instances:
[Tue Apr 27 15:49:31 2010] [error] C:\\Python26\\lib\\site-packages\\MySQLdb\\__init__.py:34: DeprecationWarning: the sets module is deprecated
[Tue Apr 27 15:49:31 2010] [error] from sets import ImmutableSet
[Tue Apr 27 15:49:31 2010] [error] Version is < 3
[Tue Apr 27 15:49:31 2010] [error] sys.modules = <module 'pywintypes' from 'C:\\Windows\\system32\\pywintypes26.dll'> id=50175152 file=C:\\Windows\\system32\\pywintypes26.dll
[Tue Apr 27 15:49:31 2010] [error] mod = <module 'pywintypes' from 'C:\\Windows\\system32\\pywintypes26.dll'> id=50175152 file=C:\\Windows\\system32\\pywintypes26.dll
[Tue Apr 27 15:49:31 2010] [error] old_mod = <module 'pywintypes' from 'C:\\Windows\\system32\\pywintypes26.dll'> id=50175152 file=C:\\Windows\\system32\\pywintypes26.dll
[Tue Apr 27 15:49:34 2010] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/san/media/css/san.css, referer: http://localhost/san/letters/
[Tue Apr 27 15:53:57 2010] [error] C:\\Python26\\lib\\site-packages\\MySQLdb\\__init__.py:34: DeprecationWarning: the sets module is deprecated
[Tue Apr 27 15:53:57 2010] [error] from sets import ImmutableSet
[Tue Apr 27 15:53:57 2010] [error] Version is < 3
[Tue Apr 27 15:53:57 2010] [error] sys.modules = <module 'pywintypes' from 'C:\\Windows\\system32\\pywintypes26.dll'> id=50175152 file=C:\\Windows\\system32\\pywintypes26.dll
[Tue Apr 27 15:53:57 2010] [error] mod = <module 'pywintypes' from 'C:\\Windows\\system32\\pywintypes26.dll'> id=61248048 file=C:\\Windows\\system32\\pywintypes26.dll
[Tue Apr 27 15:53:57 2010] [error] old_mod = <module 'pywintypes' from 'C:\\Windows\\system32\\pywintypes26.dll'> id=61248048 file=C:\\Windows\\system32\\pywintypes26.dll
Note that the 1st request was OK but the second had a different instance of the same dll.
Is this likely to cause problems?
Hi,
I am experiencing this issue as well, are there any solutions?
I attached, what is in old_mod and mod variables in new bug report at https://sourceforge.net/support/tracker.php?aid=3496224