I know how to extract a zip archive using Python, but how exactly do I display the progress of that extraction in a percentage?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
the extract method doesn’t provide a call back for this so one would have to use
getinfoto get the e uncompressed size and then open the file read from it in blocks and write it to the place you want the file to go and update the percentage one would also have to restore the mtime if that is wanted an example:this extracts
entry_nametotarget_namemost of this is also done by
shutil.copyfileobjbut it doesn’t have a call back for progress eitherthe source of the
ZipFile.extractmethod calls_extract_memberuses:where member has be converted from a name to a ZipInfo object by
getinfo(member)if it wasn’t a ZipInfo object