--- Patrick Stinson <patrickkidd.li sts@gmail.com>
escribió:
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).
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
escribió:
Right on, that seemed to work, thanks.
This is different than sys.path_hooks though, which
requires a callable or
string subclass?
This is different than sys.path_hooks though, which
requires a callable or
string subclass?
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_m odule(),
but I guess the behavior is desirable..
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_m odule(),
but I guess the behavior is desirable..
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