[Python-Dev] new import hooks & zip import

Guido van Rossum guido@python.org
Thu, 12 Dec 2002 14:47:32 -0500


> [Paul Moore]
> > > Actually, I'd say that "I can't handle this" should *always* be
> > > signalled by an exception (Only One Way To Do It), but rather than
> > > reusing ImportError, that should be a new exception type (I don't
> > > know what to call it though - ImportHandlerError?) That way, you
> > > don't risk masking real exceptions.
> 
> [GvR]
> > OK, point taken.
> 
> If we should add a new exception, would it be ok for it to live in the imp
> module? It would be a fairly specialized exception so it's kindof a shame to
> pollute the builtin namespace for it.
> 
> ImportHookError?
> 
> zipimporter currently raises ZipImportError in this case, but that's a subclass
> of ImportError... (I'm actually -0 on adding a new exception; I don't think
> reusing ImportError is all that bad.)

Let's try raising ImportError (or a subclass) for now.  It's okay for
it to live in the imp module.

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