[python-ldap] Mac OS X Lion & python-ldap

Mike Matz mmatz at wyoarea.org
Tue Feb 28 14:41:17 CET 2012

Good Morning,

I am having difficulty getting python-ldap to work on Mac OS X 10.7.3.  I installed python-ldap following the directions here<http://projects.skurfer.com/posts/2011/python_ldap_lion/>.  I tested the module after installation and it appears to have installed correctly.

mmatz$ python -c 'import ldap; print ldap.__version__'

I was then able to use the module successfully from an interactive shell.

mmatz$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ldap
>>> server = "ldap://"
>>> user = "some user"
>>> pwd = "some password"
>>> l = ldap.initialize(server)
>>> l.simple_bind_s(user, pwd)
(97, [], 1, [])
>>> l.unbind_s()

However, when I execute the same code from within a script, the script fails.

mmatz$ python ldap.py
Traceback (most recent call last):
  File "ldap.py", line 1, in <module>
    import ldap
  File "/Users/mmatz/Desktop/ldap.py", line 8, in <module>
    l = ldap.initialize(server)
AttributeError: 'module' object has no attribute 'initialize'

Any help on getting the python-ldap module to work from a script would be much appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20120228/5c73253a/attachment.html>

More information about the python-ldap mailing list