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
#...
Credits for this solution go to Matt Dnv in this answer:
I was not able to make the given answers work. Most solutions for unpacking a 7z file in python used 7zip for which I was not able to find a reliable portable version that I could curl.
Hence here is a solution to unpack a .7z file in a python 3.6 environment in Anaconda prompt 4.8.2. First I had to install 2 packages:
pip install pyunpack
pip install patool
Next I was able to unpack a 7zip filed named test.7z which was located in the same directory as this example.py script, to a folder named: output (also located in the same directory as this example.py script). The code to unpack the test.7z file can be:
from pyunpack import Archive
Archive('test.7z').extractall('./output')