[Python-Dev] Fix import errors to have data (original) (raw)

Jim Fulton jim at zope.com
Tue Jul 27 20:07:56 CEST 2004


Tim Peters wrote:

[Tim]

Sure! Jim wants to distinguish "absenceness" from "brokenness" for some reason. It's not clear to my why [Jim] Because a broken module is something that should get fixed. Maybe I don't know what "broken" means to you then. To me it means things like syntax errors, and module initialization code that raises runtime exceptions. If I try to import a module with problems like those, I don't get ImportError,

Yup

...

Is the only case you're concerned about of the "A imports B imports C, and B's attempt to import C raises an ImportError that's passed on to A" flavor?

Yes

I have one nasty example of that on hand: Python's site.py tries to import sitecustomize.py, but if the latter contains a bogus import then site.py suppresses the error, because it treats the ImportError as meaning "I guess sitecustomize.py doesn't exist -- that's fine". That one cost me an hour yesterday! So I'm becoming a believer .

:)

Jim

-- Jim Fulton mailto:jim at zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org



More information about the Python-Dev mailing list