[Tutor] gzip (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Dec 3 08:54:11 CET 2004


Hi Ramkumar,

I'm forwarding your message to Python-tutor; in your replies, please make
sure that you are using the "reply-to-all" feature in your email client.
This will allow your response to reach the others on the tutor list.
Don't rely on me alone: give the community the chance to help you.

I don't have enough information to pinpoint what the problem is yet.  I'll
have to ask more questions, and others on the Tutor list will probably
also ask a few questions.  Please try to answer them, because that will
help us give a better idea of what the problem is.


It looks like you are trying to zip up whole directories.  Does the
program work if you zip up single files?

It also appears that you're using the '-q' and '-r' options of the 'zip'
command line utility.  '-q' stands for 'quiet' mode, and although that's
nice when the command is working properly, it's not helpful when you're
debugging a situation.  Try turning quiet mode off, so that you have a
better chance of getting good error output from the zip command.  Even
better, try enabling verbose mode, so you can see better what 'zip' is
attempting to do.

Do you see anything else when you execute the program?  Does anything else
come out of standard error?


Good luck to you.


---------- Forwarded message ----------
Date: Fri, 3 Dec 2004 10:24:15 +0600
From: Ramkumar Parimal Alagan <ramster6 at gmail.com>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] gzip

This is what i intend to do:

1. The files and directories to be backed up are given in a list.
2. The backup must be stored in a main backup directory.
3. The files are backed up into a zip file.
4. The name of the zip archive is the current date and time.

the coding:

______________

import os
import time

source = ['D:\\down', 'D:\\Pics']

target_dir = 'D:\\backup'

target = target_dir + time.strftime('%Y%m%d%H%M%S') + '.zip'

zip_command = "zip -qr '%s' %s" % (target, ' '.join(source))

if os.system(zip_command) == 0:
    print 'Successful backup to', target
else:
    print 'Backup FAILED'

_____________________________

result : Backup FAILED

whats wrong ?



More information about the Tutor mailing list