|
From: Joe L. <jl...@op...> - 2001-12-15 21:27:16
|
Go one step further and use the try:except: with a variable.. ie, under som= e condition (such as a no_openldap def), do the try:except:.. otherwise, normal import On 12/15/01 12:31 PM, "Michael Str=F6der" <mi...@st...> wrote: > Jacek Konieczny wrote: >>=20 >> On Sat, Dec 15, 2001 at 09:03:44PM +0100, Michael Str=F6der wrote: >>> After checking in some of my modules below Lib/ldap/ I noticed a >>> serious drawback: >>> All modules are dependent on availability of OpenLDAP 2 libs if >>> located under Lib/ldap/ because of the "from _ldap import *" done in >>> Lib/ldap/__init__.py. >>>=20 >> [...] >>>=20 >>> Any opinions? >>=20 >> Maybe you could put "from _ldap import *" in some "try:/except:" block. >=20 > I already thought of that. But this makes error reports about > importing problems somewhat harder. E.g. if linking of shared libs > fails it's much more useful to have the original traceback instead > of e.g. a NameError exception afterwards. That's not good style. >=20 > Ciao, Michael. >=20 > _______________________________________________ > Python-LDAP-dev mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-ldap-dev |