[Tutor] Create zip files on the fly.

Negroup - negroup at gmail.com
Thu Jul 7 10:25:16 CEST 2005

Hi, in my application I need to generate a zip file (via the great
zipfile module) and pass it from function A to function B. One way to
do it is create the object from function A and write it on filesystem
via close(). Then, function B will obtain the object reading the file
from disk. After this operation, the file must be deleted from the

Now I'd like to know if it is possible to accomplish this task working
in memory directly without pass for the filesystem. I know that a
class StringIO.StringIO (memory files) exists, but I need something
valid for zipfiles.
As a final solution I have also considered to use tempfile module to
generate files that will be automatically removed.

Sorry for the simple question but I'm just trying to learn.. Do you
have some way to enlighten me?


More information about the Tutor mailing list