From: Nick B. <ni...@br...> - 2001-10-24 10:23:00
|
thanks - i was having trouble knowing where this "desc" field was. so i se now that it is: except _ldap.LDAPError, e print 'Your error is ' + e[0]['desc'] thanks for the help. nick Michael Str=F6der wrote: >=20 > Nick Bower wrote: > > > > Is there any possible way to tell what exception has been raised in > > python-ldap without catching every single possibile type of > > _ldap.LDAPError? > > > > It would be really nice in example included in the python-ldap > > documentation if an exception was caught in the following general way= : > > > > try: > > <connect, bind and search, as is currently shown> > > except: > > <display type of exception and its description> > > > > at the moment, there is no example code with exceptions in the > > documentation or distribution and i can't figure out how to catch one > > from the exception references provided without trying to catch every > > single possibility. >=20 > import ldap >=20 > try: > <connect, bind and search, as is currently shown> > except ldap.LDAPError,e: > print repr(e) >=20 > Well, exception instances are not really implemented completely > pythonic but it's a start. >=20 > Ciao, Michael. --=20 Nick Bower, Intranet Developer ni...@br... Brainstorm 388 - 396 Oxford St London W1N 9EH United Kingdom Tel 020 7074 7000 Mob 0790 5405 443 Fax 020 7074 7070 http://www.brainstorm.co.uk |