Problems with zipfile module...

Fredrik Lundh fredrik at effbot.org
Wed Jan 10 04:44:31 EST 2001


Christophe Prevost wrote:
> I've python 2.0, zlib etc... and when i try to use zipfile i've some
> problems
>
> for fch in lch:
>  if fch == sys.argv[0]: continue
>  print fch
>  dt = time.mktime(time.gmtime(os.path.getmtime(fch)))
>  if dt < veryold:
>   cpt += 1
>   if cpt == 1:
>    backup = zipfile.ZipFile(zip, "w", "ZIP_DEFLATED")

ZIP_DEFLATED is a module constant, not a string value.
try changing the above line to:

    backup = zipfile.ZipFile(zip, "w", zipfile.ZIP_DEFLATED)

>   backup.write(fch)
> if cpt != 0:
>  backup.close()

hope this helps!

cheers /F





More information about the Python-list mailing list