import hook

Jeremy Sanders jeremy+complangpython at
Sun Jun 11 16:57:07 CEST 2006

Hi - Is it possible to override the import process so that if in my program
I do


Python will look for bar in a directory which isn't called foo?

I want my module/program to be able to be run without being installed in
site-packages, so by doing "import", it should start looking for
bar in the current directory which could be called "foo-0.43".

I've tried overriding __import__, chopping out "foo." from package names,
but that tends to break. I've also tried overriding imp.find_module() but
Python never appears to use my version.

Any ideas?



Jeremy Sanders

More information about the Python-list mailing list