import hooks
gagsl-py2 at yahoo.com.ar
gagsl-py2 at yahoo.com.ar
Fri Apr 18 15:27:38 EDT 2008
--- Patrick Stinson <patrickkidd.lists at gmail.com>
escribió:
> Right on, that seemed to work, thanks.
> This is different than sys.path_hooks though, which
> requires a callable or
> string subclass?
Yes, it's different, meta_path is a generic mechanism
that doesn't depend on sys.path and is tried before
sys.path is traversed; the other is triggered by a
special sys.path entry (like a .zip file).
> After some experimentation it looks like you can
> disallow an import by
> raising an import error from your meta_path hook. It
> seems a little weird
> that python will then raise a new ImportError from
> import.c:find_module(),
> but I guess the behavior is desirable..
I think you can't make an import fail completely; if
your meta_path doesn't work, the next one is tried,
and then the standard places (where the error is
finally raised).
Looks like the "global name foo not defined" error:
sometimes it's not a global name at all, but that's
where the search finally failed.
--
Gabriel Genellina
Gabriel Genellina
Softlab SRL
Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar
More information about the Python-list
mailing list