importhook default behavior

P

Pete Shinners

I have a situation where I am wanting strict control over handling
multiple installed versions of the same modules.

All I really want to do is map a package name to a directory special
directory, and from there allow the standard python importing to continue.

I've got it working for the simple case, but it seems up to my
importhook to duplicate a lot of the standard import functionality.
Especially if it comes to importing subpackages of packages inside my
magic versioned package.

What I'd like to do is determine the real directory to use, and make a
call to the regular python importing tools. Is there somewhere in Python
I can find an importhook object that represents the default python behavior?

I suppose the ZipImport has all the functionality I'd need, but it seems
odd to be recode all that logic (.pyc or .pyo first, .dll or .so, .py,
or if directory look for __init__.[anyext]. recursive). Maybe that isn't
so hard after all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top