开发者

Error -3 while decompressing data: incorrect header check

开发者 https://www.devze.com 2022-12-24 10:18 出处:网络
I have .zip file which contain csv data. I am reading .zip file using <input type = \"file\" name = \"select_file\"/>

I have .zip file which contain csv data. I am reading .zip file using

<input type = "file" name = "select_file"/>
开发者_如何学JAVA

I want to decompress that .zip file and read csv data.

file_data = self.request.get('select_file')
file_str = zlib.decompress(file_data)  

#file_data_list = file_str.split('\n')
#file_Reader = csv.reader(file_data_list,quoting=csv.QUOTE_NONE )

I am expecting csv data in file_str but I am getting error.

error :: Error -3 while decompressing data: incorrect header check

What I have to use?


Try making a zipfile.ZipFile object instead -- as the first argument, you need an open file-like object, so first make one out of your file_data bytes with cStringIO.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号