python24.zip

Dieter Maurer dieter at handshake.de
Tue May 24 15:59:13 EDT 2005


Steve Holden <steve at holdenweb.com> writes on Sun, 22 May 2005 16:19:10 -0400:
> ...
> Indeed I have written PEP 302-based code to import from a relational
> database, but I still don't believe there's any satisfactory way to
> have [such a hooked import mechanism] be a first-class component of an
> architecture that specifically requires an os.py to exist in the file
> store during initialization.
> 
> 
> I wasn't asking for an import hook mechanism (since I already knew
> these to exist), but for a way to allow such mechanisms to be the sole
> import support for certain implementations.

We do not have "os.py" (directly) on the file system.
It lives (like everything else) in a zip archive.

This works because the "zipimporter" is put on
"sys.path_hook" before the interpreter starts executing Python code.

Thus, all you have to do: use a different Python startup
and ensure that you special importer (able to import e.g. "os")
is already set up, before you start executing Python code.


Dieter



More information about the Python-list mailing list