<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks David. &nbsp;I should have know better.<div>Mike</div><div><br></div><div><br><div><div>On Feb 28, 2012, at 10:18 AM, David N. Smith wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">

<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">

<div bgcolor="#FFFFFF">
<div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">On Feb 28, 2012, at 8:43 AM,
 "Mike Matz" &lt;<a href="mailto:mmatz@wyoarea.org">mmatz@wyoarea.org</a>&gt; wrote:</span><br>
</div>
<div><br>
</div>
<div></div>
<blockquote type="cite">
<div>Good Morning,
<div><br>
</div>
<div>I am having difficulty getting python-ldap to work on Mac OS X 10.7.3. &nbsp;I installed python-ldap following the directions&nbsp;<a href="http://projects.skurfer.com/posts/2011/python_ldap_lion/">here</a>. &nbsp;I tested the module after installation and it appears
 to have installed correctly.</div>
<div><br>
</div>
<div>
<div>mmatz$ python -c 'import ldap; print ldap.__version__'</div>
<div>2.4.8</div>
</div>
<div><br>
</div>
<div>I was then able to use the module successfully from an interactive shell.</div>
<div><br>
</div>
<div>
<div>mmatz$ python</div>
<div>Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)&nbsp;</div>
<div>[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin</div>
<div>Type "help", "copyright", "credits" or "license" for more information.</div>
<div>&gt;&gt;&gt; import ldap</div>
<div>&gt;&gt;&gt; server = "<a href="ldap://10.20.12.10:389">ldap://10.20.12.10:389</a>"</div>
<div>&gt;&gt;&gt; user = "some user"</div>
<div>&gt;&gt;&gt; pwd = "some password"</div>
<div>&gt;&gt;&gt; l = ldap.initialize(server)</div>
<div>&gt;&gt;&gt; l.simple_bind_s(user, pwd)</div>
<div>(97, [], 1, [])</div>
<div>&gt;&gt;&gt; l.unbind_s()</div>
<div><br>
</div>
</div>
<div>However, when I execute the same code from within a script, the script fails.</div>
<div><br>
</div>
<div>
<div>mmatz$ python ldap.py</div>
<div>Traceback (most recent call last):</div>
<div>&nbsp; File "ldap.py", line 1, in &lt;module&gt;</div>
<div>&nbsp; &nbsp; import ldap</div>
<div>&nbsp; File "/Users/mmatz/Desktop/ldap.py", line 8, in &lt;module&gt;</div>
<div>&nbsp; &nbsp; l = ldap.initialize(server)</div>
<div>AttributeError: 'module' object has no attribute 'initialize'</div>
</div>
<div><br>
</div>
<div>Any help on getting the python-ldap module to work from a script would be much appreciated.</div>
<div>Thanks,</div>
<div>Mike</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I suspect you have a naming conflict between your script (ldap.py) and the ldap package. &nbsp;Try changing your scripts name and re-run it.</div>
<div><br>
-- David</div>
</div>

_______________________________________________<br>python-ldap mailing list<br><a href="mailto:python-ldap@python.org">python-ldap@python.org</a><br>http://mail.python.org/mailman/listinfo/python-ldap<br></blockquote></div><br></div></body></html>