Questions tagged [python-zipfile]

Python standard-library module provides tools to create, read, write, append, and list a ZIP file.

404 questions
2
votes
1 answer

Python ZipFile giving different namelist than unzipping utility

I have a bunch of timestamped .jpgs in a zip file, and when I open that zip file using Python's ZipFile package, I see three files: >>> cameraZip = zipfile.ZipFile(zipPath, 'r') >>> cameraZip.namelist() ['20131108_200152.jpg', '20131108_203158.jpg',…
Austin A.
  • 158
  • 5
2
votes
1 answer

How to check if zip file is split across multiple archives using python's zipfile lib?

According to the zip file standard: http://www.pkware.com/documents/casestudies/APPNOTE.TXT it also supports splitting a zip file across multiple files: Spanned/Split archives created using PKZIP for Windows (V2.50 or…
Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179
2
votes
1 answer

ZipFile.extractall throws ZipFile instance has no attribute 'extractall'

Following is my code: import zipfile from zipfile import ZipFile def extract(zipFilename, dm_extraction_dir) : zipTest = ZipFile(zipFilename) zipTest.extractall(dm_extraction_dir) extract("myzip.zip", "C:/Temp") When I execute this code,…
Chetan
  • 1,507
  • 7
  • 30
  • 43
1
vote
0 answers

Python zipfile writestr method. How to write large string ? (a large CSV file)

Possible Duplicate: Create a zip file from a generator in Python? from zipfile import ZipFile with ZipFile('spam.zip', 'w') as myzip: myzip.writestr('file.csv','records1,fields') The above code works for creating a zip file. But I want to…
venky
  • 125
  • 1
  • 2
  • 9
1
vote
1 answer

Downloading multiple csv files with Streamlit

I build a Streamlit app where the end result is two Pandas dataframes that I want the user to download as separate csv files. However, it seems the Download button in Streamlit only allows the downloading of one file. One way of "combining" them is…
1
vote
0 answers

Manipulating zip archive in another zip archive

I have a kind of big zip archive (~200 GB) and in this zip archive are several other archives. The thing is, I have to move stuff around inside of the given archive. This all works perfectly fine as long as I just have one archive of depth, but as…
CSharper96
  • 25
  • 3
1
vote
1 answer

FileNotFoundError with filepath that has whitespaces using ZipFile extract

I have a zip file with this structure: Report │ └───folder1 │ │ │ └───subfolder1 | | │ │file 1 2022.txt │ └───folder2 │ file2.txt And their relative file paths are as follows: Report/folder1 / subfolder1 / file 1 2022.txt…
Jon
  • 137
  • 6
1
vote
1 answer

read a zipfile without knowing file name in python

I have a zip file in a directory. I want to read out the contents of the zipfile and after this move its content to other directories to auto sort my zipped files. thing is, the name of these zipfiles will change everytime. I learned about glob…
1
vote
1 answer

Concatenating zip files in an incremental archived format directly in python (to use in Colab)

Need to concatenate some files from github which have been split into several pieces due to the size (as from this dataset https://github.com/kang-gnak/eva-dataset) Using request these end up in my temporary data storage in the format…
1
vote
0 answers

Error when trying to extract zipfile using python (NotImplementedError: That compression method is not supported)

I am trying to unzip several zip files using a python script. However, an error always occurs at this line of code: import zipfile with zipfile.ZipFile(FILE_PATH) as zfile: zfile.extractall(OUTPUT_FILE_PATH) The error raised…
beetee
  • 11
  • 2
1
vote
0 answers

Why I got infinity loop to add files in archive?

I started learn python and trying to create 'backup' app. Want to add files from chosen directory in zip archive, but I don't understand why zipfile.write adding the same files from directory in arhive non-stop? Also it add itself to archive. import…
Twelfth641
  • 11
  • 1
1
vote
0 answers

Python 3.10.6 - Trying to use zipfile to extract from zip with outdated header

I'm working with the following block of code, in an attempt to extract data from a zip file import zipfile def get_zip(filenam,targetdir): with zipfile.ZipFile(filenam,"r") as zip_ref: zip_ref.extractall(targetdir) zip_file =…
PLundquist
  • 13
  • 4
1
vote
1 answer

Python: Zipping the subfolders including inside the data

I am trying to make the script for zipping the subfolders including inside files, and sub subfolders as well as it's own in python. below program is by entering the folder name but still, it won't work. Please, somebody, help with the script. Thank…
user17920776
1
vote
1 answer

create multiple workbooks with xlsxwriter in Django/Python

I am in the middle of a reporting function which will break up reports into different workbooks then zip the files and send them out to users. At this time, I get a successful book for the second iteration, but the first iteration seems to be…
jjulian91
  • 41
  • 3
1
vote
1 answer

ZipFile puts all parent directories inside newly created zip file

I want to create a zipfile from a select few individual files. Here is my code so far: from zipfile import ZipFile from os import walk name = 'Mia' allFiles = next(walk("C:\\Users\\jack_l\\Documents\\Image-Line\\FL…