zipfile

Progress Bar not available for zipfile? How to give feedback when program seems to hang

霸气de小男生 提交于 2019-12-28 03:07:25
问题 I am fairly new to C# and coding in general so some of this might be going about things the wrong way. The program I wrote works and compresses the file as expected, but if the source is rather large, the program appears (to Windows) to hang. I feel like I should be using a Thread but I am not sure that will help. I would use a progress bar but the 'new' (.net 4.5) library for zipfile from System.IO.Compression which replaced Ionic.Zip.ZipFile does not have a method to report progress? Is

extract files inside zip sub folders with python zipfile

与世无争的帅哥 提交于 2019-12-25 07:59:57
问题 i have a zip folder that contains files and child zip folders. I am able to read the files placed in the parent folder but how can i get to the files inside the child zip folders? here is my code to get the files inside the parent folder from io import BytesIO import pandas as pd import requests import zipfile url1 = 'https://www.someurl.com/abc.zip' r = requests.get(url1) z = zipfile.ZipFile(BytesIO(r.content)) temp = pd.read_csv(z.open('mno.csv') my question is, if lets say, I have a child

.zip file downloading as .php

拥有回忆 提交于 2019-12-25 07:58:12
问题 I have a .zip file which is generated on the server using php. The file generated is valid and I checked it by downloading it via ftp etc. I need to create a way for a user to download this file after it is generated and then the file is deleted. Here are the headers that I am sending. header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-control: public"); header("Content-Description: File Transfer"); header(

Python zipfile whole path is in file

99封情书 提交于 2019-12-25 01:22:34
问题 I'm using the code from here to make a zip file from a directory. I give the function an absolute path to a folder from a GUI. Currently, say the path is c:\users......, the zip folder structure is users...... . How can I remove the absolute path bits and just have the end folder of the path being used for the zip file? I understand that the result is right, because what I'm describing is the result from os.walk but I want to strip out the absolute path. def zipdir(path, zip): for root, dirs,

C# IFormFile as ZipFile

可紊 提交于 2019-12-24 18:31:13
问题 I have a REST API endpoint which receives zip file on .Net Core 1.1. I'm getting IFormFile from request like this var zipFile = HttpContext.Request.Form.Files.FirstOrDefault(); And then I need to pass it to service method from .Net Standard 1.5, where IFormFile is not supported. So the question is: how can I convert IFormFile to ZipFile or to some other type which is supported in Standard 1.5, or maybe there is some more proper way to operate with zip files? Thanks! 回答1: IFormFile is just a

AttributeError when creating ZipFile

送分小仙女□ 提交于 2019-12-24 10:04:21
问题 Question I get an AttributeError: 'tuple' object has no attribute 'seek' when attempting to create a zipfile.ZipFile from a file path. I have no idea why, the traceback doesn't make any sense in relation to my code, is this a bug in the zipfile module, or did I not set something up properly? I followed all documentation as best as I could, to no avail. What is wrong with what I am doing, and is there a workaround / fix for it? And could it also be a mistake I am making with urllib in any way,

Python: unziping special files into memory and getting them into a DataFrame

巧了我就是萌 提交于 2019-12-24 09:26:12
问题 I'm quite stuck with a code I'm writing in Python, I'm a beginner and maybe is really easy, but I just can't see it. Any help would be appreciated. So thank you in advance :) Here is the problem: I have to read some special data files with an special extension .fen into a pandas DataFrame.This .fen files are inside a zipped file .fenx that contains the .fen file and a .cfg configuration file. In the code I've written I use zipfile library in order to unzip the files, and then get them in the

Error when loading audio file from zip in python

不羁的心 提交于 2019-12-24 04:08:13
问题 I am making a game, and I need to load some password protected audio files from a .zip file, but I get this error: io.UnsupportedOperation: seek io.UnsupportedOperation: seek io.UnsupportedOperation: seek b'hey you did it!' #THIS IS FROM THE PROGRAM Traceback (most recent call last): File "C:\Python36\lib\zipfile.py", line 849, in read data = self._read1(n) File "C:\Python36\lib\zipfile.py", line 917, in _read1 data += self._read2(n - len(data)) File "C:\Python36\lib\zipfile.py", line 949, in

Create symlink inside a zipfile in memory using python

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 03:52:52
问题 I am looking for a way to create a zipfile in memory and include a symlink inside the zipfile. So far I have found this link and try the following code: from zipfile import ZipInfo from zipfile import ZipFile from zipfile import ZIP_DEFLATED, ZIP_STORED from cStringIO import StringIO import codecs buf = StringIO() zipfile = ZipFile( buf,'w') zipinfo = ZipInfo() zipinfo.filename = u'bundle/' zipinfo.compress_type = ZIP_STORED zipinfo.external_attr = 040755 << 16L # permissions drwxr-xr-x

Accessing .zipx with Python

你。 提交于 2019-12-24 02:54:09
问题 I'm attempting to write a very simple script that counts the number of entries/files a given ZIP file has, for some statistics. I'm using the zipfile library, and I'm running into this problem where the library appears not to support .zipx format. bash-3.1$ python zipcount.py t.zipx Traceback (most recent call last): File "zipcount.py", line 10, in <module> zipCount(file) File "zipcount.py", line 5, in zipCount with ZipFile(file, "r") as zf: File "c:\Python34\lib\zipfile.py", line 937, in _