I would like to unpack a .7z file. According to this question I can use the lzma package to do this.
I was expecting something like
import lzma
#...
with lzma.open('myFile.7z') as f:
f.extractall('.')
To extract the file into the current directory but it seems something like this does not exist. Furthermore trying something like
import lzma
#...
with lzma.open('myFile.7z') as f:
file_content = f.read()
print(file_content)
did yield _lzma.LZMAError: Input format not supported by decoder
. How can I check the format? And I am quite surprised because I thought both 7zip and the .7z format are open source and python should support everything.
I saw a lot of answers where people were just calling the 7zip executable with a subprocess but this is not want I want to do. I am looking for a plain python3 solution.