newbie question: nested archives and zipfile

Diez B. Roggisch deets at nospam.web.de
Thu Feb 1 14:22:26 CET 2007


gilbeert at gmail.com wrote:

> I sorry, but I'm not very familiar with Python.
> Please, help to solve my problem with reading file from "nested" zip
> archive.
> There is an ear_file.ear and inside this file there is a war_file.war
> and inside this file there is a jar_file.jar.
> I have to read content of a file (my_file.txt) from inside a
> jar_file.jar:
> ear_file.ear > war_file.war > jar_file.jar > my_file.txt
> 
> Is it possible to directly read my_file.txt from inside this kind of
> nested archive?
> Please, give an example how to do that.

No.
 
> Do I have to open ear_file.ear, read war_file.war, write it to file
> and then open writed war_file.war, read jar_file.jar, write it to
> file
> and then open wreted jar_file.jar and read my_file.txt??

Yes. Depending on the size of the files, it might be possible to use
StringIO to keep the files in-memory without using temp-files. 

Diez


More information about the Python-list mailing list