[Python-Dev] PEP 273: Import Modules from Zip Archives

James C. Ahlstrom jim@interet.com
Mon, 29 Oct 2001 09:45:08 -0500


Finn Bock wrote:

> >> Would entries in the static python dict be removed when a zipfile is
> >> removed from sys.path?
> >
> >It can be arranged that they are removed at some later point
> >(e.g. when sys.path is next searched).
> 
> An API to do this could be usefull for jython. Right now we depend on
> the GC thread to close the file. Since files are a limited resource it
> would be a good thing to have an explicit way to clean up the cached
> resources.

The static Python dictionary is a memory object which uses no open
file descriptors.  If an element of sys.path contains ".zip" and hasn't
been seen before, the zip archive is opened, searched, and closed.
The key is the name, the value includes the archive name and offset.
Thereafter, the zip archive is never opened unless it contains a needed file.
So I don't think there is a problem.

> myself), I just didn't dare to put such a limit on my jython
> implementation.

I don't understand the jpython implementation, so please point out
all problems so we can fix them now.

JimA