Problem unpacking file


I have a zip that, inside it there are several files to be unzipped. So long, I'm using the following method to decipher the same:?

with closing(z), zipfile.ZipFile(io.BytesIO(z.content)) as myzip:

However I came across the situation that inside the zip exists a file with unicode can example:

- myfile.wav
- myfile2.wav
- my§ile.wav

How can I handle these files, to unzip them correctly?

asked by anonymous 16.03.2017 / 21:46

1 answer


To work with Unicode characters, you need to add a functional comment type in the script header to not display this error. I'm talking about the # - - coding: utf-8 - -, used for that case. Here's an example, for Python 2.7:

- - coding: utf-8 - -

with closing (z), zipfile.ZipFile (io.BytesIO (z.content)) as myzip:                 myzip.extractall (local_path)

It's not coming off to indicate that this is a comment or the asterisks in the response between the hyphens I do not know why when I write, but consider them in the writing of the program.

03.04.2017 / 13:45