J
Jeremy Sanders
Hi - Is it possible to override the import process so that if in my program
I do
import foo.bar
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 foo.bar", 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?
Thanks
Jeremy
I do
import foo.bar
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 foo.bar", 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?
Thanks
Jeremy