Category "python-zipfile"

save multiple objects to zip directly from memory

I'd like to save multiple objects, e.g. figures, created in a loop directly to a zip file, without saving them in directory. At the moment I'm saving the figure

Zipfile namelist() missing members from archive

I'm currently trying to open an .xlsx file with zipfile on Python, finding all files with namelist(), then using .count() to find all images in .png format with

Reading ARFF from ZIP with zipfile and scipy.io.arff

I want to process quite big ARFF files in scikit-learn. The files are in a zip archive and I do not want to unpack the archive to a folder before processing. He

Extract a txz file inside a zipfile in Python

I have a zipfile which has the .txz file. Something like this: file1.zip | -- file2.txz | -- abc.txt I have used ZipFi

On zipfile read of shapefile from URL, fault for initial value not str

Using Python 3.5, following example for reading shapefile zipfile from URL and updating for P3.5. Code is below. I've looked at other cases and attempted to a

Create zipfile at local and write files from s3

I am creating a zipfile on my local machine and would like to write files from s3. So far I'm unable to do it. Here's what I have in the mean time. import os i

Getting blank content from namelist()

I am trying to write a script that will allow me to search for the most recently downloaded file (which will be a docx), zip that file, and then search for spec

Zipfile module for Python3.6: write to Bytes instead of Files for Odoo

I've been trying to use the zipfile module for Python 3.6 to create a .zip file which contains multiple objects. My problem is, I have to manage files from an

Get root folder of extracted Zipfile

Using Zipfile in Python 3.6, I am able to successfully extract a zip using: with zipfile.ZipFile(my_zip,"r") as zip_ref: zip_ref.extractall('./download')

"Bad magic number for file header" for working concatenated zip file using zipfile in Python 3.7

I'm trying to use the Python zipfile library to unzip a split ZIP file by concatenating all file splits and then unzipping the final product, but I keep getting

Using zipfile to archive directory contents while skipping files from list

I'm using zipfile to create an archive of all files in a directory (recursively, while preserving directory structure including empty folders) and want the proc

How to create a password protected zipfile using the zipfile module

I have a password protected zip-file called important.zip, it contains 1 folder, the password for the zip-file is 123, however when I use run this code with a w

Python - load an in-memory ZipFile object as bytes

I have a script which creates a closed in-memory ZipFile object that I need to post as a bytestring (using requests); how do I do that? I have tried opening th

Could not find a version that satisfies the requirement zipfile (from versions: )

I used pip install zipfile, and error went out: Could not find a version that satisfies the requirement zipfile (from versions: ) No matching distribution

zipfile header language encoding bit set differently between Python2 and Python3

I would like this code to work the same when run with Python 2 or Python 3 from zipfile import ZipFile, ZipInfo with ZipFile("out.zip", 'w') as zf: conten

zipfile writing .zip output to .py file location

The following script is writing a zip into the directory where the .py file is located, but I need it to write it to the same location as the original folder.

How to zip a file to STDOUT with zipfile?

I have a program that creates a zip file containing a couple of files using zipfile. It takes an output filename as argument, but if no file or - is given, it s

Well formed XML throw XMLSyntaxError when read in a zipfile

I have a well formed XML embedded in a zip file <?xml version="1.0" encoding="utf-8"?> <board> <columns> <c name="Work" position="1"&

Zipfile with no parent folder

I am able to compress files into a single zip file, however when I open the zip file the contents always include a "parent folder" which has the same exact name

Python zipfile does not unzip folders for windows zip archive

I have a zip file which was created on Windows machine using this tool System.IO.Compression.ZipFile (this zip archive contains many files and folders). I have