[Python-Dev] Re: Change to sys.path[0] for Python 2.3
Jack Jansen
jack@oratrix.nl
Tue, 27 Nov 2001 14:49:33 +0100
> 1) Create an initial sys.path but without its first item.
> 2) Import site, os, sitecustomize, etc.
> 3) Insert a new item as sys.path[0].
This will not work for a frozen MacPython program. In such a program the
sys.path initializer is ["$(APPLICATION)"].
So, there's no empty current directory entry in sys.path[0], the only thing in
sys.path is the magic cookie "$(APPLICATION)". Early in startup, before
site.py is imported, the cookie is replaced by the full pathname of the
application. The import code knows that if it sees a file on sys.path (as
opposed to a directory) it will look in that file for frozen PYC resources.
And, before you ask, I'm aware that in the future this code will have to test
whether or not the file has a .zip extension, and go down the zip-import leg
if it has.
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm