Search code examples
pythonldappython-ldap

Can somebody help me with python-ldap initialize process?


I am using OpenSuse Tumbleweed and try to connect my pythons script with an ldap server.

following my code:

import ldap
connection = ldap.initialize("*address*")

But i got following error:

 File "ldap.py", line 1, in <module>
import ldap
 File "*path*/ldap.py", line 3, in <module>
connection = ldap.initialize("*address*")
AttributeError: 'module' object has no attribute 'initialize'

I looked up the python-ldap documentation, but the "initialize" functio should exist :/

When i try to install python-ldap, the console told me, that this is already installed.

Can somebody help me?

best regards


Solution

  • I found my mistake:

    The file was named ldap.py an was the only file in this directory. But know, python tried to import this file into the same file.

    I renamed it to test_ldap.py and know everything works fine

    Best Regards