I am using python 3.4
I have a crawler that is extracting 7z Console SFX files and I wish to extract them programmatically.
Currently I have only been able to do so with a subprocess call:
import subprocess
seven_zip = r"C:\Program Files\7-Zip\7z.exe"
tempfile = r"temp.exe" # SFX Archive
subprocess.call(seven_zip + ' x ' + tempfile + ' -aoa')
This is problematic because users of this script may not have 7zip installed, or may have it installed in a different directory. Further, running a subprocess doesn't give me direct access to the extracted items like running a normal zFile extraction would. I can workaround this by extracting to a temporary directory then parsing the files in said directory, but that is cumbersome.
I am thinking there's got to be a way of extracting the 7z Console SFX files with Python (maybe something with pylzma?), but I can't seem to find any questions on the subject here.
Update: I've still had limited success using py7zlib. Again I note that this is intended for extracting SFX (executable) archives, and not a .7z archive. Perhaps there is an application for py7zlib for such files, but I'm unable to find any examples.