[python-ldap] import _ldap: ImportError: Cannot load specified object
Zhang Huangbin
zhbmaillistonly at gmail.com
Tue Aug 27 17:53:16 CEST 2013
Dear developers,
I tried to run my python web application on OpenBSD 5.3 with python-ldap-2.4.13, but it raises below error message:
import _ldap
ImportError: Cannot load specified object
I'm not sure whether it's a bug of my application or python-ldap, so i wrote a simple cgi script to test it again, got the same error. The CGI script is really simple:
#!/usr/local/bin/python2.7
import ldap
print "Content-Type: text/html"
print ''
The full error log in Apache (unchrooted) log file:
Traceback (most recent call last):
File "/var/www/cgi-bin/test.py", line 2, in <module>
import ldap
File "/usr/local/lib/python2.7/site-packages/python_ldap-2.4.13-py2.7-openbsd-5.3-amd64.egg/ldap/__init__.py", line 22, in <module>
import _ldap
ImportError: Cannot load specified object
[Tue Aug 27 23:51:28 2013] [error] [client 172.16.244.1] Premature end of script headers: /var/www/cgi-bin/test.py
I installed python-ldap-2.4.13 manually, and it works within Python interpreter:
$ python
>>> import ldap
>>> import _ldap
>>> from _ldap import *
I can see file _ldap.* below:
# ls /usr/local/lib/python2.7/site-packages/python_ldap-2.4.13-py2.7-openbsd-5.3-amd64.egg/_ldap*
/usr/local/lib/python2.7/site-packages/python_ldap-2.4.13-py2.7-openbsd-5.3-amd64.egg/_ldap.py
/usr/local/lib/python2.7/site-packages/python_ldap-2.4.13-py2.7-openbsd-5.3-amd64.egg/_ldap.pyc
/usr/local/lib/python2.7/site-packages/python_ldap-2.4.13-py2.7-openbsd-5.3-amd64.egg/_ldap.pyo
/usr/local/lib/python2.7/site-packages/python_ldap-2.4.13-py2.7-openbsd-5.3-amd64.egg/_ldap.so
Is it a python-ldap issue? Any solution?
More information about the python-ldap
mailing list