python-zipfile Questions

6

Solved

I have a script that creates zip files of dirs containing symlinks. I was surprised to find that the zipfiles have zipped the targets of the links as opposed to the links themselves, which is what ...
Byrd asked 3/3, 2016 at 21:0

9

I am creating an ZIP file with ZipFile in Python 2.5, it works OK so far: import zipfile, os locfile = "test.txt" loczip = os.path.splitext (locfile)[0] + ".zip" zip = zipfile....
Coronado asked 20/8, 2008 at 0:16

30

Solved

How can I create a zip archive of a directory structure in Python?
Strop asked 6/12, 2009 at 11:12

5

I'm trying to extract user-submitted zip and tar files to a directory. The documentation for zipfile's extractall method (similarly with tarfile's extractall) states that it's possible for paths to...
Dun asked 8/4, 2012 at 3:7

1

I'm trying to create a zip file on the fly of a directory and return it to the user over a Flask App. The below works great for smaller directories but I'd also like to achieve this with large dire...
Seethe asked 7/11, 2022 at 2:1

4

Solved

In a django project, I need to generate some pdf files for objects in db. Since each file takes a few seconds to generate, I use celery to run tasks asynchronously. Problem is, I need to add each ...
Pad asked 8/2, 2012 at 14:26

4

Using zip file, I indicate files locate within an other folder for example: './data/2003-2007/metropolis/Matrix_0_1_0.csv' My problem is that, when I extract it, the files are found in ./data/2003...
Tomas asked 29/5, 2013 at 8:47

2

Solved

I have a problem with compression in Python. I know I should call the ZIP_DEFLATED method when writing to make the zip file compressed, but it does not work for me. I have 3 PDF documents in the C:...
Gastrocnemius asked 9/8, 2013 at 16:54

4

Solved

Seem to be knocking my head off a newbie error and I am not a newbie. I have a 1.2G known-good zipfile 'train.zip' containing a 3.5G file 'train.csv'. I open the zipfile and file itself without any...
Cuspidation asked 9/10, 2012 at 23:2

2

Solved

As title, I creates the zip file from my Django backend server (hosted on a Ubuntu 14.04.1 LTS) using the python zipfile module: zipfile.ZipFile(dest_path, mode='w', compression=zipfile.ZIP_DEFLAT...
Woolcott asked 27/1, 2016 at 8:55

5

I'm using the current code to extract the files from a zip file while keeping the directory structure: zip_file = zipfile.ZipFile('archive.zip', 'r') zip_file.extractall('/dir/to/extract/files/') ...
Dickdicken asked 31/12, 2011 at 18:49

3

Solved

I have searched the web high and low but still couldn't find a solution for the above problem. Does anyone out there know why and if so how it can be done? psw="dg" ZipFile.extractall("data.zip",...
Territerrible asked 16/8, 2014 at 4:10

6

Solved

I have two files in two different directories, one is '/home/test/first/first.pdf', the other is '/home/text/second/second.pdf'. I use following code to compress them: import zipfile, StringIO buff...
Brunella asked 18/4, 2013 at 19:54

3

Solved

There is folder path: P:\\2018\\Archive\\ There are many zipfiles I want to create programmatically, but am starting with test. I will name this test zip file "CO_007_II.zip" and will attempt to...
Lyontine asked 9/5, 2018 at 23:22

2

Solved

I'm trying to read ZipFile data from a URL and via StringIO parse the data inside the ZipFile as csv using pandas.read_csv r = req.get("http://seanlahman.com/files/database/lahman-csv_2014-02-14.z...
Haymaker asked 12/8, 2015 at 14:8

3

Solved

I made a little helper function: import zipfile def main(archive_list=[],zfilename='default.zip'): print zfilename zout = zipfile.ZipFile(zfilename, "w") for fname in archive_list: print "wri...
Louise asked 12/11, 2010 at 15:56

4

Solved

Using the zipfile module to unzip a large data file in Python works correctly on Python 2 but produces the following error on Python 3.6.0: BadZipFile: Bad CRC-32 for file 'myfile.csv' I traced t...
Beersheba asked 5/1, 2017 at 19:20

8

Solved

When I extract files from a ZIP file created with the Python zipfile module, all the files are not writable, read only etc. The file is being created and extracted under Linux and Python 2.5.2. A...
Lazuli asked 12/1, 2009 at 6:51

9

Solved

I read through the zipfile documentation, but couldn't understand how to unzip a file, only how to zip a file. How do I unzip all the contents of a zip file into the same directory?
Udall asked 10/8, 2010 at 16:19

2

Solved

I am trying to zip a directory using python zipfile module and its working well.But now i want to exclude some folders.ie if my director tree is like abc def ghi jkl mno then i want to archive ...
Lipase asked 3/8, 2015 at 4:21

1

Is it possible to force a specific timestamp for a file when adding it to a zipfile? Something along these lines: with ZipFile('spam.zip', 'w') as myzip: myzip.write('eggs.txt', date_time=(1752,...
Dammar asked 20/6, 2012 at 7:55

5

Solved

I have lots of zipped files on a Linux server and each file includes multiple text files. what I want is to extract some of those text files, which have the same name across zipped files and save...
Stultz asked 19/5, 2017 at 22:36

2

is there anyway to make a file inside a zip file seekable in Python without reading it to memory? I tried the obvious procedure but I get an error since the file is not seekable: In [74]: inputZi...
Matthieu asked 10/10, 2012 at 14:34

2

Solved

I'm using python's zipfile module. Having a zip file located in a path of: /home/user/a/b/c/test.zip And having another file created under /home/user/a/b/c/1.txt I want to add this file to existing...
Radar asked 14/12, 2015 at 15:21

3

Solved

I have a zip archive: my_zip.zip. Inside it is one txt file, the name of which I do not know. I was taking a look at Python's zipfile module ( http://docs.python.org/library/zipfile.html ), but cou...
Wormseed asked 13/1, 2012 at 1:26

© 2022 - 2024 — McMap. All rights reserved.