Hi,

I've got a problem here.

def compress_the_file(zip_file_name, files_to_compress, sSourceDir):
    """
    Condenses all the files into one single file for easy transfer
    """

    try:
        import zipfile
    except ImportError:
        sys.stderr.write("Aieeee! module not found.\n")

    try:
        os.chdir(sSourceDir)
    except:
        #TODO: Handle this exception
        pass

    filename = zipfile.ZipFile(zip_file_name, "a")
#    try:
#        filename = zipfile.ZipFile(zip_file_name, "a")
#    except:
#        #TODO Handle the exception
#        sys.stderr.write("\nAieee! Some error exception in creating
zip file %s\n" % (zip_file_name))
#        sys.exit(1)

    filename.write(files_to_compress, files_to_compress,
zipfile.ZIP_DEFLATED)
    filename.close()

The line
filename = zipfile.ZipFile(zip_file_name, "a")
throws an exception if the given filename is not present already.
Shouldn't it create a file (in case one is not there) since it is
"append" mode ??


Ritesh

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to