Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to run MoinMoin under Apache on SLES 11P1. I'm getting the following error in my Apache log when somebody tries to access the site:

mod_wsgi (pid=20772): Target WSGI script '/srv/www/wiki/moin.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=20772): Exception occurred processing WSGI script '/srv/www/wiki/moin.
wsgi'.
Traceback (most recent call last):
  File "/srv/www/wiki/moin.wsgi", line 44, in <module>
    from MoinMoin.web.serving import make_application
  File "/usr/local/lib64/python2.6/site-packages/MoinMoin/web/serving.py", line 14, in <module>
    from MoinMoin import version, log
  File "/usr/local/lib64/python2.6/site-packages/MoinMoin/log.py", line 92, in <module>
    import logging.config
  File "/usr/lib/python2.6/logging/config.py", line 30, in <module>
    import sys, logging, logging.handlers, string, socket, struct, os, traceback, types
  File "/usr/lib/python2.6/logging/handlers.py", line 27, in <module>
    import logging, socket, types, os, string, cPickle, struct, time, re
ImportError: /usr/lib64/python2.6/lib-dynload/cPickle.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8

However, I have no problem if I execute the failing statement manually from a Python interpreter:

$ python
'import site' failed; use -v for traceback
Python 2.6.6 (r266:84292, Feb 17 2011, 08:36:48) 
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging, socket, types, os, string, cPickle, struct, time, re
>>>

What could cause that error when running under Apache, but not when running Python at the command-line?

Edit: It looks like they are hitting different shared libraries. Apache is hitting /usr/lib64/python2.6/lib-dynload/cPickle.so and the Python interpreter that I invoke at the command-line is hitting /usr/lib/python2.6/lib-dynload/cPickle.so

$ python -v 
...
>>> import cPickle
dlopen("/usr/lib/python2.6/lib-dynload/cPickle.so", 2);
dlopen("/usr/lib/python2.6/lib-dynload/cStringIO.so", 2);
share|improve this question

1 Answer 1

up vote 1 down vote accepted

As yourself have noted that Apache (64-bit) is loading different libraries while you are executing different python binary from command line. Fix the binaries/libraries for 64-bit installation of Python2.6. This should hopefully go away.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.