[Zope3-dev] Re: zope.configuration and ImportErrors

Rocky Burt rocky at serverzen.com
Wed Nov 30 14:28:45 EST 2005


Florent Guillaume wrote:
> Today it's very hard to debug ImportErrors raise inside modules  
> referenced through a zcml directive, because the ImportError is  
> swallowed an no traceback comes back to the user. Just a
>   ConfigurationError: ('Invalid value for', 'class', "Couldn't  import 
> some.class, cannot import name somename")
> which doesn't point anywhere useful.
> 
> I'd like to modify zope.configuration.config to something like:
> 
>         try:
>             mod = __import__(mname, *_import_chickens)
>         except ImportError, v:
> +            if sys.exc_info()[2].tb_next is not None:
> +                # ImportError was caused deeper
> +                raise
>             raise ConfigurationError, (
>                 "Couldn't import %s, %s" % (mname, v)
>                 ), sys.exc_info()[2]
> 

+1 for any fix.

+1 for this fix :)



-- 
Rocky Burt
ServerZen Software -- http://www.serverzen.com
ServerZen Hosting -- http://www.serverzenhosting.net
News About The Server -- http://www.serverzen.net



More information about the Zope3-dev mailing list