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

Jim Fulton jim at zope.com
Tue Jul 27 19:45:07 CEST 2004


Thomas Heller wrote:

Jim Fulton <jim at zope.com> writes:

...

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.findmodule do this? On Windows:

Nope. It doesn't handle packages.

import compiler.ast import imp imp.find_module('compiler.ast') Traceback (most recent call last): File "", line 1, in ? ImportError: No module named compiler.ast

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