[Pythonmac-SIG] Import ldap not behaving as expected
U n d e r a c h i e v e r
takeme2your at rocketmail.com
Mon Oct 10 18:29:52 CEST 2005
Hi all
Doubtless there is a very simple solution to my problem ...
I've installed python2.4 with a handful of supporting modules (well, one,
ldap) from darwinports.
The following works fine provided I type it in interactively in a python
session, but not as a script:-
$ cat bin/testldapimport.py
#!/opt/local/bin/python
import ldap
import os
import sys
def goodbye(exitmessage, exitcode):
print exitmessage
sys.exit(exitcode)
goodbye("quiting",0)
$
$
$ /opt/local/bin/python
Python 2.4.1 (#1, Oct 10 2005, 11:15:09)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1671)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> #!/opt/local/bin/python
... import ldap
>>> import os
>>> import sys
>>>
>>> def goodbye(exitmessage, exitcode):
... print exitmessage
... sys.exit(exitcode)
...
>>> goodbye("quiting",0)
quiting
But running the same coede as a script generates an error:-
$
$ /opt/local/bin/python bin/testldapimport.py
Traceback (most recent call last):
File "bin/testldapimport.py", line 2, in ?
import ldap
File "/Users/glaw/bin/ldap.py", line 23, in ?
except ldap.LDAPError, error_message:
AttributeError: 'module' object has no attribute 'LDAPError'
Cluestick? I'm lost as to what could be going wrong here...
--
takeme2your at rocketmail.com
U n d e r a c h i e v e r
More information about the Pythonmac-SIG
mailing list