Entry
I am writing a C++ program with embedded python. How can I redirect import commands to read the file from a different source, possibly not a true file at all but an entry in a zip file?
Jun 4th, 2000 04:39
unknown unknown, Michael Hudson
I don't know if being embedded offers other ways of doing this, but in
Python code (which should work here), you'd probably want to use Greg
Stein's imputil.py:
http://www.lyra.org/greg/python/
If you want to override *all* import unconditionally, you can assign
to __builtin__.__import__, but that requires a certain amount of Python
internals knowledge.