Questions tagged [python-zipfile]

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

404 questions
0
votes
1 answer

Deleting a folder in a zip file using the Python zipfile module

Is it possible to delete a folder from inside a file using the ZipFile module in Python?
tew
  • 2,723
  • 5
  • 23
  • 35
0
votes
5 answers

zipfile several passwords match

I have very strange behavior with zipfile class and I hope that someone can help me solve the problem that bothers me. I wrote a short script which tries to open zip file encrypted by password (it was ziped by WinRar), but turned out that zipfile…
0
votes
2 answers

Trying to unzip a zipfile, then within the folders that result, find and unzip any/all zipfiles

I must use Python 2.6! This is a task that I really want to automate, the situation is static and once I create this, I'll be golden (good). I must create one, stand alone script (in Idle, I hope) that will: Unzip a single original zipfile (in_Zip)…
Gregory Lund
  • 21
  • 1
  • 3
0
votes
1 answer

How to check if zipfile is not already closed

What is the best way in Python to check if a ZipFile object is not already closed? For the moment I am doing this in a class: try: self.zf.open(archive_name).close() except RuntimeError: self.zf = zipfile.ZipFile(self.path) with…
BioGeek
  • 21,897
  • 23
  • 83
  • 145
-1
votes
1 answer

Downloading a Zip file and extracting its content in Python

I have this code to download a zip file from a URL and extract the contents. But the name of the excel file changes every month. This would result in duplicates getting created. And it is not possible to predict the names each time new data gets…
prashanth manohar
  • 531
  • 1
  • 13
  • 30
-1
votes
1 answer

Unzipping with specific name

Based on this answer, is there an option to rename the file when extracting it? Or what is the best solution to do so? Didn't find anything on the documentation
Warok
  • 383
  • 1
  • 7
  • 20
-1
votes
1 answer

How do cancel an operation(unzip) in a few seconds in Python?

Some files do not know what they are from have long extract For example, if it is not extracted for 60 seconds or the time is passed, I want to delete the original file to cancel the operation. import pyzipper with pyzipper.AESZipFile('test.zip',…
aziz n
  • 1
-1
votes
1 answer

how can i adding custom path for saving the zip_file

I am creating a zip file using the zipfile module. It works like a charm. but that's file, saved in the executed script place. my script path is a: [b]c:/User/Administrator/[/b]script.py and the zipfile saved…
User12
  • 138
  • 8
-1
votes
2 answers

zipfile extractall pauses script (Raspberry python3)

I have a dictionary with 10 words (one IS the correct password) script on python3 (on Raspberry) iterates over dictionary when it gets to the right password , pauses/stops (extracts the zip file) but resumes the script and does not exit nor it print…
-1
votes
1 answer

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 wrong password the folder is still getting extracted, how can I make it that I can not…
wishmaster
  • 1,437
  • 1
  • 10
  • 19
-1
votes
2 answers

tkFileDialog and Zipfile error: "AttributeError: '_io.TextIOWrapper' object has no attribute 'namelist'"

I'm trying to use tkfiledialog to select a file, and then use Zipfile to extract the contents. from zipfile import ZipFile from tkinter import filedialog ZipFile.extractall(filedialog.askopenfile()) Which returns this error: AttributeError:…
clarktwain
  • 210
  • 1
  • 3
  • 13
-1
votes
1 answer

Python zipfile large file hangs forevers

python -m zipfile -c ~/testbig.zip ~/verylarge4gbfile.zip It hangs forever. Is there a better python library I can use? I'm using the command as a POC that the library doesn't seem to work for large files, so I need another python library option,…
Sophie McCarrell
  • 2,831
  • 8
  • 31
  • 64
-2
votes
1 answer

The application “ ” can’t be opened. After extracting using zipfile in python macos

I'm unable to launch an application after using python to pull a build from a server and then extract. I get error message 'The application “ ” can’t be opened' Iv tried chmod +x on the executable in contents and then the application launches to a…
Daniel_88
  • 11
  • 4
-3
votes
1 answer

I have a problem regarding extracting in python

I have been using the following code to extract the files: import os, zipfile extension = ".zip" for item in os.listdir(dir_name): # loop through items in dir if item.endswith(extension): # check for ".zip" extension file_name =…
1 2 3
26
27