zipfile

Extracting a .app from a zip file in Python, using ZipFile

I'm trying to extract new revisions of Chromium.app from their snapshots, and I can download the file fine, but when it comes to extracting it, ZipFile either extracts the chrome-mac folder within as a file, says that directories don't exist, etc. I am very new to python, so these errors make little sense to me. Here is what I have so fa...

load a pickle file from a zipfile

For some reason I cannot get cPickle.load to work on the file-type object returned by ZipFile.open(). If I call read() on the file-type object returned by ZipFile.open() I can use cPickle.loads though. Example .... import zipfile import cPickle # the data we want to store some_data = {1: 'one', 2: 'two', 3: 'three'} # # create a zipp...

Python: Preserve file attributes in ZipFile

Hello. I'm looking for a way to preserve the file attributes (eg. read-only) of a file that gets written to a zipfile.ZipFile instance. The files I add to the zip archive gets their file attributes reset, eg. the read-only flag is gone when inspecting the archive with zip applications and after unzip. My current environment is Windows...

Problem with unzipping file

I have two zip files, both of them open well with Windows Explorer and 7-zip. However when i open them with Python's zipfile module [ zipfile.ZipFile("filex.zip") ], one of them gets opened but the other one gives error "BadZipfile: File is not a zip file". I've made sure that the latter one is a valid Zip File by opening it with 7-Zi...

android problem in extracting zip file using ZipFile

Hi! I have this code: try{ File f = new File("/data/cizip.zip"); if(f.exists()){ ZipFile zf = new ZipFile(f); //this always throws an error /*some of my codes here*/ } catch(IOException e){ AlertDialog.Builder abd = new AlertDialog.Builder(this); abd.setMessage(e.getMessage()); abd.show(); } the line ZipFile zf = new Zi...

When creating a zip archive, what constitutes a duplicate entry

In a Java web application I am creating a zip file from various in-memory files (stored as byte[]). Here's the key bit of code: ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(baos); for (//each member of a collection of objects) { PDFDocument pdfDocument = //gene...

Unziping files in python

I read through the zipfile modules docs, but couldn't understand how to unzip a file, only zip a file. What is the simplest way to unzip all the contents of a zip file into the same directory? ...

Unarchiving the zip file is not working

Hi all..... i am new to iPhone programming..can anybody help me out from the following problem i am using the fallowing code to unarcive a zip file.. its not working... and printing the NSLog(@"Failure To Unzip Archive"); msg self.fileManager = [NSFileManager defaultManager]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSD...

I can't delete a folder that I just extracted from a zip file in python

So here's my problem. I have a python script that takes a zipfile and extracts its contents. Then based on some constraint, I will try to delete the folder whose contents were just extracted. For some reason I get an error, WindowsError: [Error 5] Access is denied: 'Foldername' when i try to delete that folder. The simple code looks like...

Setting path X in "ZipFile zipfile = new ZipFile("X");"

I'm having problems setting the path of the zip file, X, in ZipFile zipfile = new ZipFile("X");. I don't want to hardcode the path such that it becomes ZipFile zipfile = new ZipFile("C:/docs/data.zip");. I want to do something like : ZipFile zipfile = new ZipFile(getServletContext().getResourceAsStream("/WEB-INF/" + request.getAttrib...

How do I extract a zip file with Python's ZipFile module?

Possible Duplicate: Unziping files in python How do I extract a zip file with Python's ZipFile module? An example script would be awesome! ...

How do I setpassword to compressed zip files in Python

I get this error when I try to set a password to a zip file. Below is the code/error I get. Please give me an example of the correct way to do it. This is just the password part of the script... the entire script is to long to post. Code: password = "dog" password = zipfile.setpassword(pwd) Error received when hitting the password...

How can i extract files using custom names with zipfile module from python?

I want to add suffix to names of my files, for example uuid. How can i extract files using zipfile and pass custom names? ...