Accessing .zipx With Python
I'm attempting to write a very simple script that counts the number of entries/files a given ZIP file has, for some statistics. I'm using the zipfile library, and I'm running into
Solution 1:
chilkat might work for this. It's not a free library but there is a 30 day trial. Here is an example from http://www.example-code.com/python/ppmd_compress_file.asp:
import sys
import chilkat
compress = chilkat.CkCompression()
# Any string argument automatically begins a 30-day trial.
success = compress.UnlockComponent("30-day trial")
if (success != True):
print"Compression component unlock failed"
sys.exit()
compress.put_Algorithm("ppmd")
# Decompress back to the original:
success = compress.DecompressFile("t.zipx", "t")
if (success != True):
print compress.lastErrorText()
sys.exit()
print"Success!"
The API documentation: http://www.chilkatsoft.com/refdoc/pythonCkCompressionRef.html
Solution 2:
There is no direct python package to unzip the zipx files in python. So, One simple way to unzip it is using subprocess and winzip application. Please find the below code.
import subprocess
command = "C:\Program Files\WinZip\wzunzip.exe""D:\Downloads\hello.zipx""D:\unzip_location"
subprocess.run(command, shell=True, timeout=120)
Post a Comment for "Accessing .zipx With Python"