python24.zip
Steve Holden
steve at holdenweb.com
Fri May 27 13:21:45 EDT 2005
Dieter Maurer wrote:
> 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.
>
It might help others like me if you were to document this setup, as I
was unable to persuade the interpreter to start without producing the
dire-sounding warning messages I mentioned in the bug report.
regards
Steve
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
More information about the Python-list
mailing list