1

Topic: "No module named ldap" at opening iredadmin

hi

i have installed the open source edition on my ubuntu 10.04 server.
roundcube is working, but when im trying to start iredadmin i get this error:

<type 'exceptions.ImportError'> at /
No module named ldapPython    /usr/share/apache2/iredadmin/libs/ldaplib/core.py in <module>, line 28
Web    GET https://192.168.0.11/iredadmin/

Traceback (innermost first)
/usr/share/apache2/iredadmin/libs/ldaplib/core.py in <module>
...
import ldap, ldap.filter ...
▶ Local vars
/usr/share/apache2/iredadmin/controllers/ldap/basic.py in <module>
...
from libs.ldaplib import core, auth, admin, domain, ldaputils ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in _delegate
...
                mod = __import__(mod, globals(), locals(), [""]) ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in handle
...
        return self._delegate(fn, self.fvars, args) ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in process
...
                    return self.handle() ...
▶ Local vars
Request information
INPUT

No data.
COOKIESVariable    Value
iRedAdmin-OSE    'e4478d17622875a477f565c09b81608048ddb14c'
roundcube_sessid    '6801e47106c7f1d49c6390bb40dacb53'
smplrefresh    '5'
template    'phpsysinfo'

METAVariable    Value
app_stack    [<web.application.application instance at 0x22bec9ac>]
fullpath    u'/'
headers    []
home    u'https://192.168.0.11/iredadmin'
homedomain    u'https://192.168.0.11'
homepath    u'/iredadmin'
host    u'192.168.0.11'
ip    u'192.168.0.22'
lang    'de_DE'
method    u'GET'
output    u''
path    u'/'
protocol    u'https'
query    u''
realhome    u'https://192.168.0.11/iredadmin'
status    '200 OK'

ENVIRONMENTVariable    Value
DOCUMENT_ROOT    '/var/www'
GATEWAY_INTERFACE    'CGI/1.1'
HTTPS    '1'
HTTP_ACCEPT    'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'
HTTP_ACCEPT_CHARSET    'iso-8859-1, utf-8, utf-16, *;q=0.1'
HTTP_ACCEPT_ENCODING    'deflate, gzip, x-gzip, identity, *;q=0'
HTTP_ACCEPT_LANGUAGE    'de-DE,de;q=0.9,en;q=0.8'
HTTP_CACHE_CONTROL    'no-cache'
HTTP_CONNECTION    'Keep-Alive, TE'
HTTP_COOKIE    'template=phpsysinfo; smplrefresh=5; roundcube_sessid=6801e47106c7f1d49c6390bb40dacb53; iRedAdmin-OSE=e4478d17622875a477f565c09b81608048ddb14c'
HTTP_COOKIE2    '$Version=1'
HTTP_HOST    '192.168.0.11'
HTTP_TE    'deflate, gzip, chunked, identity, trailers'
HTTP_USER_AGENT    'Opera/9.80 (X11; Linux x86_64; U; de) Presto/2.6.31 Version/10.70'
PATH    '/usr/local/bin:/usr/bin:/bin'
PATH_INFO    '/'
PATH_TRANSLATED    '/var/www/index.html'
QUERY_STRING    ''
REMOTE_ADDR    '192.168.0.22'
REMOTE_PORT    '44290'
REQUEST_METHOD    'GET'
REQUEST_URI    '/iredadmin'
SCRIPT_FILENAME    '/usr/share/apache2/iredadmin/iredadmin.py'
SCRIPT_NAME    '/iredadmin'
SERVER_ADDR    '192.168.0.11'
SERVER_ADMIN    'webmaster@localhost'
SERVER_NAME    '192.168.0.11'
SERVER_PORT    '443'
SERVER_PROTOCOL    'HTTP/1.1'
SERVER_SIGNATURE    '<address>Apache/2.2.14 (Ubuntu) Server at 192.168.0.11 Port 443</address>\n'
SERVER_SOFTWARE    'Apache/2.2.14 (Ubuntu)'
mod_wsgi.application_group    'server.fam-bauer.eu|/iredadmin'
mod_wsgi.callable_object    'application'
mod_wsgi.listener_host    ''
mod_wsgi.listener_port    '443'
mod_wsgi.process_group    'iredadmin'
mod_wsgi.reload_mechanism    '1'
mod_wsgi.script_reloading    '1'
mod_wsgi.version    (2, 8)
wsgi.errors    <mod_wsgi.Log object at 0x22be50e0>
wsgi.file_wrapper    <built-in method file_wrapper of mod_wsgi.Adapter object at 0x229277b8>
wsgi.input    <mod_wsgi.Input object at 0x22be15e8>
wsgi.multiprocess    False
wsgi.multithread    True
wsgi.run_once    False
wsgi.url_scheme    'https'
wsgi.version    (1, 0)

ldap is up and working, python-lad is installed - for me looks everything fine....

2

Re: "No module named ldap" at opening iredadmin

Can you please paste me the log content in apache?

3

Re: "No module named ldap" at opening iredadmin

ZhangHuangbin wrote:

Can you please paste me the log content in apache?

you mean the error.log?

[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] 0.0 (1): SELECT * FROM sessions WHERE session_id='619fe1a7da1211856d2eed37a3376a377261b497'
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] 0.0 (2): SELECT * FROM sessions WHERE session_id='619fe1a7da1211856d2eed37a3376a377261b497'
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] 0.0 (3): UPDATE sessions SET atime = '2010-08-19T22:23:22.914704' WHERE session_id='619fe1a7da1211856d2eed37a3376a377261b497'
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] Traceback (most recent call last):
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 242, in process
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]     return self.handle()
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 233, in handle
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]     return self._delegate(fn, self.fvars, args)
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 411, in _delegate
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]     mod = __import__(mod, globals(), locals(), [""])
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]   File "/usr/share/apache2/iredadmin/controllers/ldap/basic.py", line 29, in <module>
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]     from libs.ldaplib import core, auth, admin, domain, ldaputils
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]   File "/usr/share/apache2/iredadmin/libs/ldaplib/core.py", line 29, in <module>
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]     import ldap, ldap.filter
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] ImportError: No module named ldap
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22]
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] 0.0 (4): SELECT * FROM sessions WHERE session_id='619fe1a7da1211856d2eed37a3376a377261b497'
[Thu Aug 19 22:23:22 2010] [error] [client 192.168.0.22] 0.0 (5): UPDATE sessions SET data = 'KGRwMQpTJ3VzZXJuYW1lJwpwMgpOc1MnbGFuZycKcDMKUydkZV9ERScKcDQKc1MnaXAnCnA1ClYx\\nOTIuMTY4LjAuMjIKcDYKc1MnbG9nZ2VkJwpwNwpJMDAKc1MncGFnZXNpemVsaW1pdCcKcDgKSTMw\\nCnNTJ3Nlc3Npb25faWQnCnA5ClMnNjE5ZmUxYTdkYTEyMTE4NTZkMmVlZDM3YTMzNzZhMzc3MjYx\\nYjQ5NycKcDEwCnNTJ2ZhaWxlZFRpbWVzJwpwMTEKSTAKc1Mnd2VibWFzdGVyJwpwMTIKUyd3d3dA\\nZmFtLWJhdWVyLmV1JwpwMTMKcy4=\\n' WHERE session_id='619fe1a7da1211856d2eed37a3376a377261b497'

4

Re: "No module named ldap" at opening iredadmin

Seems it can't find python-ldap module.
Can you please try below command to verify it:

# python
>>> import ldap

If it says "ImportError: No module named ldap", that means you don't have python-ldap installed. Please try to install it with apt-get:

# apt-get update
# apt-get install python-ldap

5 (edited by netlord 2010-08-23 17:28:53)

Re: "No module named ldap" at opening iredadmin

ZhangHuangbin wrote:

Seems it can't find python-ldap module.

If it says "ImportError: No module named ldap", that means you don't have python-ldap installed.

well - you are right.

when i try to import the ldap module i get the error with "no module named ldap".
the python-ldap moule is installed, but it doesnt work/cant be found...

obviously the configuration under ubuntu (10.04) is a little bit different to other distributions...
i already asked in the ubunutu-forum (http://ubuntuforums.org/showthread.php?p=9746822) but i got no answer....

does someone here haves an idea how to configure python?

6

Re: "No module named ldap" at opening iredadmin

hi

i believe i am a little step further.

i've installed dataflake.ldapconnection - via "sudo easy_install dataflake.ldapconnection"

when i now try to load ldap i get no error! wink

but when i start irdedadmin i get this error:

<type 'exceptions.UnicodeDecodeError'> at /
'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128)Python    /usr/share/apache2/iredadmin/libs/../templates/default/ldap/login.html in top-level template code, line 29
Web    GET https://192.168.0.11/iredadmin/

Traceback (innermost first)
/usr/share/apache2/iredadmin/libs/../templates/default/ldap/login.html in top-level template code
...
{% from "msgHandlers.html" import loginMsgHandler with context %} ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/Jinja2-2.5-py2.6.egg/jinja2/environment.py in render
...
        return self.environment.handle_exception(exc_info, True) ...
▶ Local vars
/usr/share/apache2/iredadmin/controllers/ldap/basic.py in GET
...
                    msg=i.get('msg'), ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in handle_class
...
            return tocall(*args) ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in _delegate
...
            return handle_class(cls) ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in handle
...
        return self._delegate(fn, self.fvars, args) ...
▶ Local vars
/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py in process
...
                    return self.handle() ...
▶ Local vars
Request information
INPUT

No data.
COOKIESVariable    Value
iRedAdmin-OSE    '5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
roundcube_sessid    '5051f4f6d6051ccf7e37cb527511e782'
smplrefresh    '5'

METAVariable    Value
app_stack    [<web.application.application instance at 0x210799ac>]
fullpath    u'/'
headers    []
home    u'https://192.168.0.11/iredadmin'
homedomain    u'https://192.168.0.11'
homepath    u'/iredadmin'
host    u'192.168.0.11'
ip    u'192.168.0.22'
lang    'de_DE'
method    u'GET'
output    u''
path    u'/'
protocol    u'https'
query    u''
realhome    u'https://192.168.0.11/iredadmin'
status    '200 OK'

ENVIRONMENTVariable    Value
DOCUMENT_ROOT    '/var/www'
GATEWAY_INTERFACE    'CGI/1.1'
HTTPS    '1'
HTTP_ACCEPT    'text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'
HTTP_ACCEPT_CHARSET    'iso-8859-1, utf-8, utf-16, *;q=0.1'
HTTP_ACCEPT_ENCODING    'deflate, gzip, x-gzip, identity, *;q=0'
HTTP_ACCEPT_LANGUAGE    'de-DE,de;q=0.9,en;q=0.8'
HTTP_CACHE_CONTROL    'no-cache'
HTTP_CONNECTION    'Keep-Alive, TE'
HTTP_COOKIE    'smplrefresh=5; roundcube_sessid=5051f4f6d6051ccf7e37cb527511e782; iRedAdmin-OSE=5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
HTTP_COOKIE2    '$Version=1'
HTTP_HOST    '192.168.0.11'
HTTP_TE    'deflate, gzip, chunked, identity, trailers'
HTTP_USER_AGENT    'Opera/9.80 (X11; Linux x86_64; U; de) Presto/2.6.31 Version/10.70'
PATH    '/usr/local/bin:/usr/bin:/bin'
PATH_INFO    '/'
PATH_TRANSLATED    '/var/www/index.html'
QUERY_STRING    ''
REMOTE_ADDR    '192.168.0.22'
REMOTE_PORT    '45052'
REQUEST_METHOD    'GET'
REQUEST_URI    '/iredadmin'
SCRIPT_FILENAME    '/usr/share/apache2/iredadmin/iredadmin.py'
SCRIPT_NAME    '/iredadmin'
SERVER_ADDR    '192.168.0.11'
SERVER_ADMIN    'webmaster@localhost'
SERVER_NAME    '192.168.0.11'
SERVER_PORT    '443'
SERVER_PROTOCOL    'HTTP/1.1'
SERVER_SIGNATURE    '<address>Apache/2.2.14 (Ubuntu) Server at 192.168.0.11 Port 443</address>\n'
SERVER_SOFTWARE    'Apache/2.2.14 (Ubuntu)'
mod_wsgi.application_group    'server.fam-bauer.eu|/iredadmin'
mod_wsgi.callable_object    'application'
mod_wsgi.listener_host    ''
mod_wsgi.listener_port    '443'
mod_wsgi.process_group    'iredadmin'
mod_wsgi.reload_mechanism    '1'
mod_wsgi.script_reloading    '1'
mod_wsgi.version    (2, 8)
wsgi.errors    <mod_wsgi.Log object at 0x210720e0>
wsgi.file_wrapper    <built-in method file_wrapper of mod_wsgi.Adapter object at 0x20db47b8>
wsgi.input    <mod_wsgi.Input object at 0x2106e5e8>
wsgi.multiprocess    False
wsgi.multithread    True
wsgi.run_once    False
wsgi.url_scheme    'https'
wsgi.version    (1, 0)


You're seeing this error because you have web.config.debug set to True. Set that to False if you don't to see this.


and

[Sun Aug 29 11:22:08 2010] [error] /usr/local/lib/python2.6/site-packages/MySQL_python-1.2.2-py2.6-linux-i686.egg/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] 0.0 (1): DELETE FROM sessions WHERE '2010-08-28T11:22:08.421941' > atime
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] 0.0 (2): SELECT * FROM sessions WHERE session_id='5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] 0.0 (3): SELECT * FROM sessions WHERE session_id='5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] 0.0 (4): UPDATE sessions SET atime = '2010-08-29T11:22:08.443347' WHERE session_id='5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] Traceback (most recent call last):
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 242, in process
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     return self.handle()
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 233, in handle
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     return self._delegate(fn, self.fvars, args)
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 415, in _delegate
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     return handle_class(cls)
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/web.py-0.34-py2.6.egg/web/application.py", line 390, in handle_class
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     return tocall(*args)
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/share/apache2/iredadmin/controllers/ldap/basic.py", line 48, in GET
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     msg=i.get('msg'),
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/local/lib/python2.6/site-packages/Jinja2-2.5-py2.6.egg/jinja2/environment.py", line 891, in render
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     return self.environment.handle_exception(exc_info, True)
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]   File "/usr/share/apache2/iredadmin/libs/../templates/default/ldap/login.html", line 30, in top-level template code
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]     {% from "msgHandlers.html" import loginMsgHandler with context %}
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128)
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22]
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] 0.0 (5): SELECT * FROM sessions WHERE session_id='5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
[Sun Aug 29 11:22:08 2010] [error] [client 192.168.0.22] 0.0 (6): UPDATE sessions SET data = 'KGRwMQpTJ3VzZXJuYW1lJwpwMgpOc1MnbGFuZycKcDMKUydkZV9ERScKcDQKc1MnaXAnCnA1ClYx\\nOTIuMTY4LjAuMjIKcDYKc1MnbG9nZ2VkJwpwNwpJMDAKc1MncGFnZXNpemVsaW1pdCcKcDgKSTMw\\nCnNTJ3Nlc3Npb25faWQnCnA5ClMnNWE1NzJhMWQyNjUwNGYzY2YxYWZmZTFhYzUxZGZiOWFjMzkx\\nZTQ0ZScKcDEwCnNTJ2ZhaWxlZFRpbWVzJwpwMTEKSTAKc1Mnd2VibWFzdGVyJwpwMTIKUyd3d3dA\\nZmFtLWJhdWVyLmV1JwpwMTMKcy4=\\n' WHERE session_id='5a572a1d26504f3cf1affe1ac51dfb9ac391e44e'
[Sun Aug 29 11:22:09 2010] [error] [client 192.168.0.22] File does not exist: /var/www/favicon.ico, referer: https://192.168.0.11/iredadmin

any hints?

thx
netlord

7

Re: "No module named ldap" at opening iredadmin

Can you change 'lang' to 'en_US', restart apache and test it again?
I guess the 'de_DE' translation is not full completed, and it causes this issue.

Also, iRedAdmin doesn't require python module "dataflake.ldapconnection".

8

Re: "No module named ldap" at opening iredadmin

ZhangHuangbin wrote:

Can you change 'lang' to 'en_US', restart apache and test it again?
I guess the 'de_DE' translation is not full completed, and it causes this issue.

yes, youre right.

thanks for helping