[Python-Dev] Fix import errors to have data

Guido van Rossum guido at python.org
Tue Jul 27 22:44:15 CEST 2004


> 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.
>> AFAIK, the only way to do it is by trying the import. Unfortunately,
> the error type alone isn't enough to tell whether the error you
> caught is due to the error condition you are trying to test.
>> Perhaps providing an API is a better way to go.

This exists as imp.find_module.
> In general, however, I hate the approach of formatting errors
> as they are raised, rather than as they are converted to strings.

Agreed.
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /