On Jul 10, 3:36 pm, e-gor <[EMAIL PROTECTED]> wrote: > Rebuilding apache doesn't help > > # python > Python 2.5.1 (r251:54863, Jun 28 2007, 13:12:40) > [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6 > Type "help", "copyright", "credits" or "license" for more information.>>> > import md5 > >>> import _md5 > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: No module named _md5 > > >>> import hashlib > >>> import _hashlib > > so i have error when importing _md5 and have no erroro when importing > md5. What it mean? :)
Run: ldd _hashlib.so You'll need to go find _hashlib.so in the Python library directory. As I said, what is possibly happening is that _hashlib.so has a dependency on some shared library, probably the SSL libraries, and this clashes with either the version used by Apache or which is compiled into Apache. Thus, also do: ldd httpd Ie., look at shared library dependencies for Apache executable. If both show dependencies on same library but different versions you will have a problem. If no SSL library dependency for httpd, then it is using compiled in version of SSL and you will have a problem. In either case, you will need to rebuild Apache so that it uses the same SSL shared library as Python _hashlib.so and as a dynamic library dependency, not compiled in. To absolutely confirm it is _hashlib.so, you can also write a basic mod_python handler which does a direct import of _hashlib. If that fails, then that module is definitely the cause. Now if this thinking is correct, the reason that _md5 shows as the problem, is that if Python can't import _hashlib in the hashlib module, it will catch the exception and try and import _md5 instead, but that doesn't exist in Python 2.5. Importing md5 works, because it actually imports hashlib these days and not _md5 directly. Graham > On Jul 7, 2:40 pm, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > On Jul 7, 6:25 pm, e-gor <[EMAIL PROTECTED]> wrote: > > > > Switching off mod_php doesn't help. > > > > when i import module md5 from command prompt there are no errors: > > > > # python > > > Python 2.5.1 (r251:54863, Jun 28 2007, 13:12:40) > > > [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6 > > > Type "help", "copyright", "credits" or "license" for more information.>>> > > > import md5 > > > >>> import blahblah > > > > Traceback (most recent call last): > > > File "<stdin>", line 1, in <module> > > > ImportError: No module named blahblah > > > Can you import 'hashlib' on the command line: > > > import hashlib > > > In Python 2.5 how the hash library modules is done was changed. This > > has caused issues before: > > > http://www.modpython.org/pipermail/mod_python/2007-April/023508.html > > http://www.modpython.org/pipermail/mod_python/2007-April/023512.html > > > A suitable answer wasn't found as it fixed itself when person > > recompiled Apache. > > > My suspicion is that in recompiling Apache, Apache was then using the > > same shared library version of something (probably SSL libraries) as > > one of the Python hash modules was using. Previous to that it was > > using different versions and that caused a problem when loading one of > > the Python modules, thus resulting in it falling back to trying to > > load _md5 when it shouldn't have. Loading _md5 would fail as in Python > > 2.5 it doesn't necessarily exist as hashlib modules replace it from > > memory. > > > Note, in recompiling Apache it may be important to ensure that it > > finds and uses system SSL libraries, otherwise it will use one from > > its own source code and that is where the clash may arise because > > Python will use the system one instead. > > > Graham > > > > On Jul 6, 4:26 pm, Roboto <[EMAIL PROTECTED]> wrote: > > > > > i'm not great at this, but a shot in the dark - turn off mod_php > > > > > On Jul 5, 2:59 pm, e-gor <[EMAIL PROTECTED]> wrote: > > > > > > I have python 2.5.1, django report errors: > > > > > >Mod_pythonerror: "PythonHandler django.core.handlers.modpython" > > > > > > Traceback (most recent call last): > > > > > > File "/usr/local/lib/python2.5/site-packages/mod_python/apache.py", > > > > > line 193, in Dispatch > > > > > result = object(req) > > > > > > File "/usr/local/lib/python2.5/site-packages/django/core/handlers/ > > > > > modpython.py", line 177, in handler > > > > > return ModPythonHandler()(req) > > > > > > File "/usr/local/lib/python2.5/site-packages/django/core/handlers/ > > > > > modpython.py", line 145, in __call__ > > > > > self.load_middleware() > > > > > > File "/usr/local/lib/python2.5/site-packages/django/core/handlers/ > > > > > base.py", line 31, in load_middleware > > > > > raise exceptions.ImproperlyConfigured, 'Error importing middleware > > > > > %s: "%s"' % (mw_module, e) > > > > > > ImproperlyConfigured: Error importing middleware > > > > > django.middleware.common: "No module named _md5" > > > > > > When i write import md5 from python command prompt i have no errors. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---