ImportError ao executar o aplicativo WSGI no Apache: símbolo indefinido: PyUnicodeUCS2_DecodeUTF8

1

Estou tentando executar o MoinMoin no Apache no SLES 11P1. Estou recebendo o seguinte erro no meu log do Apache quando alguém tenta acessar o 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

No entanto, não tenho nenhum problema se eu executar a instrução com falha manualmente a partir de um interpretador Python:

$ 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
>>>

O que poderia causar esse erro ao executar o Apache, mas não ao executar o Python na linha de comando?

Editar: parece que eles estão atingindo diferentes bibliotecas compartilhadas. O Apache está atingindo /usr/lib64/python2.6/lib-dynload/cPickle.so e o interpretador Python que invoco na linha de comando está atingindo /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);
    
por Lorin Hochstein 17.02.2011 / 18:45

1 resposta

1

Como você mesmo observou, o Apache (64 bits) está carregando bibliotecas diferentes enquanto você está executando um binário python diferente da linha de comando. Corrigir os binários / bibliotecas para instalação de 64 bits do Python2.6. Isso deve ir embora.

    
por 18.01.2012 / 13:24