Python ldap AttributeError

jenny picture jenny · Mar 24, 2010 · Viewed 23.6k times · Source

I have an python error AttributeError: 'module' object has no attribute 'initialize' I am running Python 2.6.2 on Solaris 10 UNIX and recently installed the pythonldap 2.3.9. The script is very basic, only has these 2 lines. Can anyone tell me why?? Traceback error below.

#!/usr/local/bin/python

import ldap, sys

con = ldap.initialize('ldap://localhost')

Traceback (most recent call last): File "./myldap.py", line 5, in con = ldap.initialize('ldap://localhost') AttributeError: 'module' object has no attribute 'initialize'

Regards, Jenny

Answer

Mike Graham picture Mike Graham · Mar 24, 2010

Did you name a file in the current directory ldap.py that is shadowing the one that you want?