0

I'm using py7zr to compress a very large file.

I'm using this syntax from the example:

with py7zr.SevenZipFile('target.7z', 'w') as z:
    z.writeall('./base_dir')

Being the file very large, I would like to show a progress bar.

Since I know how to show a progress bar, both using tqdm or enlighten, specifically I want to know how to have py7zr doing the compression a bit at a time, and retrieve the status of the compression periodically from py7zr.

How can I do that?

robertspierre
  • 3,218
  • 2
  • 31
  • 46
  • Do you want to know how to show a progress bar on the screen or how to get progress information from the in-progress compression? They are two quite different questions and there's not a lot of detail in your question. – Kemp Feb 07 '22 at 10:44
  • In loop use write instead of writeall, calculate sizeof(files_compressed)/sizeof(total_files_to_be_compressed) * 100. Show progress bar using tqdm. – Arunesh Singh Feb 07 '22 at 10:50
  • @Kemp I want to know how to get progress information from py7zr. I have edited my question. Thanks for pointing out my question was ambiguous. – robertspierre Feb 07 '22 at 11:02
  • How `sizeof(files_compressed)/sizeof(total_files_to_be_compressed) * 100` are supposed to work? By definition of compression, files_compressed < total_files_to_be_compressed, so that calculation would never reach 100% – robertspierre Feb 07 '22 at 11:04

0 Answers0