[Python-Dev] Fix import errors to have data
theller at python.net
Tue Jul 27 19:35:24 CEST 2004
Jim Fulton <jim at zope.com> writes:
> Tim Peters wrote:
>> [Jim Fulton]
>>>No, it won't. For example, suppose foo imports B. B tries to import
>>>C, but fails. B is now broken, but it is still importable. Actually,
>>>both foo and B can be imported without errors, even though they are
>> Then you're proposing a way for a highly knowledgable user to
>> anticipate, and partially worm around, that Python leaves behind
>> insane module objects in sys.modules.
> No. I'm proposing a way for a Python developer to detect the
> presence or absence of a module.
> Hm, perhaps it would be better to provide an API (if there isn't one
> already) to test whether a module is present.
Doesn't imp.find_module do this? On Windows:
>>> import imp
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named termios
(<open file 'c:\python23\lib\pty.py', mode 'U' at 0x00981760>, 'c:\\python23\\lib\\pty.py', ('.py',
More information about the Python-Dev