module import, but different
G. David Kuhlman
dkuhlman at netcom.com
Sat Jun 12 19:48:26 EDT 1999
Tim Peters (tim_one at email.msn.com) wrote:
> Ack, enough already. If your packages don't match your directories, the
> builtin importer simply doesn't do what you want. Look in the Library
> manual's Built-in Functions section for __import__: that's the builtin
> function an "import" stmt invokes. You can replace it with whatever you
> like. The std imp module packages many functions that will be helpful when
> doing this. As I said at the start, I don't understand this stuff (never
> had reason to use it!), but Greg Stein is widely reputed to have developed a
> much more flexible import mechanism; maybe DejaNews will turn up something
> useful.
> the-distutils-sig-may-also-be-your-friend-ly y'rs - tim
If you decide to follow Tim's suggestion and implement your own
import, then search DejaNews for "imputil". I'm not at a machine
where I have the URL, but if you can't find it, email me.
I've used imputil.py to modify the search behavior to
extract/import scripts from our own script library/database before
searching directories on disk. imputil makes it easy enough to do
so that even I was able to use it -- a strong recommendation.
Our special import seems to work, although I'll have to admit that
I have not made it "production grade" yet.
- Dave
More information about the Python-list
mailing list