[sugar] Python Zip Library

Nolan Hughes nolan.e.hughes at gmail.com
Tue Nov 18 14:46:25 EST 2008


I'm part of team developing the Bundle Activity which will handle zip (and
other) archives and have run into a problem with the Zip library in Python.
We are currently trying to zip a list of files, and then have the program
perform other operations with the resulting zip file. The problem is that
Python seems to run asynchronously, so the program execution skips the zip
file completion and goes on to the next instructions (which is NOT what we
want). In other words, the instructions that handle the resulting zip file
get run before the zip file is completely finished. Our code looks like:

myZip = zipfile.ZipFile(file_name, 'w')
try:
   for a_file in file_list:
     myZip.write(a_file)
finally:
  myZip.close()

# zip handling instructions
shutil.copy(file_name, journal_location)
# ... put the zip file in the journal ...
....

What can we do to have this work?

Thanks,

Nolan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/sugar/attachments/20081118/9d7a157b/attachment.htm 


More information about the Sugar mailing list