470,811 Members | 1,030 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

Re: import hooks

En Tue, 15 Apr 2008 22:14:18 -0300, Patrick Stinson
What's the current way to install an import hook? I've got an embedded
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 sys.modules because their
names will not be unique across the app. They will, however, be unique
between scripts that I (do* want to see each other).
Basically, I want to return a certain module from a name-based filter.
already written a type in C with find_module and load_module, but it
seem to work when I add the type to sys.path_hooks. I wrote a simple one
that worked just fine from a pure script file run through python.exe.
From that description alone I can't say what's happening; you should post
some code.
Also, if your importer isn't disk-based, perhaps using sys.meta_path is

Gabriel Genellina

Jun 27 '08 #1
0 1112

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Petri Savolainen | last post: by
reply views Thread by Gonçalo Rodrigues | last post: by
4 posts views Thread by Matt Whiteley | last post: by
8 posts views Thread by Grant D. Watson | last post: by
reply views Thread by Mustafa Thamer | last post: by
43 posts views Thread by Dan Perl | last post: by
reply views Thread by Carlos Ribeiro | last post: by
5 posts views Thread by Steve Holden | last post: by
23 posts views Thread by Shane Hathaway | last post: by
reply views Thread by | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.