I want to extract a 7-Zip archive in a Python script. It works fine except that it spits out the extraction details (which is huge in my case).
Is there a way to avoid t
in hex editor find copyright and replace it's value with 0000 https://imgur.com/a/ZJswkyq
One possibility would be to spawn the child process with popen, so its output will come back to the parent to be processed/displayed (if desired) or else completely ignored (create your popen
object with stdout=PIPE
and stderr=PIPE
to be able to retrieve the output from the child).
To show just the last 4 lines...
7z x -y some_archive.7z | tail -4
gives me:
Everything is Ok
Size: 917519
Compressed: 171589
The switch -y is to answer yes to everything (in my case to override existing files).
On Unix-like operating systems (Linux, BSD, etc.) the shell command 7z ... >/dev/null
will discard all text written by 7z
to standard output. That should cover all the status/informational messages written by 7z
.
It seems that 7z
writes error messages to standard error so if you do >/dev/null
, error messages will still be shown.
The | FIND
is a good alternative to show what happened without displaying insignificant text.
7zip does not have an explicit "quiet" or "silent" mode for command line extraction.
One possibility would be to spawn the child process with popen, so its output will come back to the parent to be processed/displayed (if desired) or else completely ignored (create your popen object with stdout=PIPE and stderr=PIPE to be able to retrieve the output from the child).
Otherwise Try doing this:
%COMSPEC% /c "%ProgramFiles%\7-Zip\7z.exe" ...