[python-ldap] Mac OS X Lion & python-ldap
Mike Matz
mmatz at wyoarea.org
Tue Feb 28 17:21:01 CET 2012
Thanks David. I should have know better.
Mike
On Feb 28, 2012, at 10:18 AM, David N. Smith wrote:
On Feb 28, 2012, at 8:43 AM, "Mike Matz" <mmatz at wyoarea.org<mailto:mmatz at wyoarea.org>> wrote:
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__'
2.4.8
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://10.20.12.10:389"
>>> 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.
Thanks,
Mike
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.
-- David
_______________________________________________
python-ldap mailing list
python-ldap at python.org<mailto:python-ldap at python.org>
http://mail.python.org/mailman/listinfo/python-ldap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20120228/5c8bf80b/attachment-0001.html>
More information about the python-ldap
mailing list