On Sun, 2011-08-07 at 11:11 -0700, Josh Haberman wrote:
> When reading about import hooks, I came across a blog entry comment
> that says:
>
> One additional thing to note about ihooks is that it's
> somewhat seriously broken on Python 2.5 and newer and there
> seems to be little or no inter
Josh Haberman wrote:
> When reading about import hooks, I came across a blog entry comment
> that says:
>
> One additional thing to note about ihooks is that it's
> somewhat seriously broken on Python 2.5 and newer and there
> seems to be little or no interest in fixing it. It's
> probabl
--- Patrick Stinson <[EMAIL PROTECTED]>
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
sy
Right on, that seemed to work, thanks.
This is different than sys.path_hooks though, which requires a callable or
string subclass?
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
En Wed, 16 Apr 2008 09:04:36 -0300, Patrick Stinson
<[EMAIL PROTECTED]> escribió:
> I am defining a simple finder/loader object and adding it to
> sys.meta_path
> like this:
>
> PyRun_SimpleString("import sys; import ousiainternal; sys.meta_path =
> [ousiainternal.OusiaImporter]");
You should
I am defining a simple finder/loader object and adding it to sys.meta_path
like this:
PyRun_SimpleString("import sys; import ousiainternal; sys.meta_path =
[ousiainternal.OusiaImporter]");
The following C code defines the loader object:
static void
MyImporter_dealloc(PyObject *self)
{
self-
En Tue, 15 Apr 2008 22:14:18 -0300, Patrick Stinson
<[EMAIL PROTECTED]> escribió:
> What's the current way to install an import hook? I've got an embedded
> app
> that has a few scripts that I want to import each other, but that are
> not in
> sys.modules. I intentionally keep them out of sy