[python-ldap] Mac OS X Lion & python-ldap
David N. Smith
david.smith at cornell.edu
Tue Feb 28 16:18:01 CET 2012
On Feb 28, 2012, at 8:43 AM, "Mike Matz" <mmatz at wyoarea.org<mailto:mmatz at wyoarea.org>> wrote:
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.
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://10.20.12.10:389"
>>> user = "some user"
>>> pwd = "some password"
>>> l = ldap.initialize(server)
>>> l.simple_bind_s(user, pwd)
(97, , 1, )
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>
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.
I suspect you have a naming conflict between your script (ldap.py) and the ldap package. Try changing your scripts name and re-run it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the python-ldap