简体   繁体   中英

webpy with mod_wsgi on apache2 - weird pymongo bson error

I'm running webpy with apache2. This is a really weird error that has got me flummoxed. Have never seen such an error before and I'm wondering what might be the cause.

The error is in the bson pymongo module.

[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] mod_wsgi (pid=27117): Target WSGI script '/var/www/webpy-app/borg/src/app.py' cannot be loaded 
as Python module.
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] mod_wsgi (pid=27117): Exception occurred processing WSGI script '/var/www/webpy-app/borg/src/ap
p.py'.
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] Traceback (most recent call last):
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/var/www/webpy-app/borg/src/app.py", line 1, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]     import web,json,csv,pymongo,pdb,sys
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/pymongo
/__init__.py", line 61, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/pymongo
/connection.py", line 39, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/pymongo
/mongo_client.py", line 44, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/bson/__
init__.py", line 41, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/bson/_c
bson.py", line 7, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/bson/_c
bson.py", line 6, in __bootstrap__
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] AttributeError: PyCapsule_Import "datetime.datetime_CAPI" is not valid

Here's the WSGI config in httpd.conf

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /borg /var/www/webpy-app/borg/src/app.py/
WSGIPythonPath /opt/python2.7/lib/python2.7/site-packages/
Alias /borg/static /var/www/webpy-app/borg/src/static/
AddType text/html .py

<Directory /var/www/webpy-app/>
      Order deny,allow
      Allow from all
</Directory>

Is the error because of a python library incompatibility issue ? Am not sure. Any help will be greatly appreciated.

Figured this out by setting WSGIPythonHome to the appropriate location. WSGI was looking at an old Python library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM