I am trying to read from two zipfiles locally, and perform a sort of merge. Take some subset of files from Zip #1, and a subset from Zip #2 and merge them into a Zip #3. The issue is that the ZipFile/ZipInfo appears to behaving strangely, and having empty ZipInfo's. I have the code working perfectly on my local Windows machine, however, on my remote Linux machine it is producing the results below...
My code looks something like this:
out_data = BytesIO()
with ZipFile(out_data, 'w') as out_zip:
with ZipFile(path_to_zip, 'r') as zip_1:
file_list = zip_1.infolist()
# ...
with ZipFile(path_to_zip2, 'r') as zip_2:
file_list = zip_2.infolist()
print(file_list)
for file in file_list:
print(f"File: {file.filename}")
....
The problem is that when printing the zip.infolist() I get an output that looks like this:
[,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,]
If I perform a len() on it, it returns the correct number of files, and when printing an individual ZipInfo when iterating over it I get this:
File:
File:
File:
...
As if the ZipInfo is empty/None, or something. The resulting zip_data (BytesIO) does have an amount of bytes, so it does appear to be having data written to it.
When I write the value of zip_data to file, it appears to be a valid working ZipFile. However, I am wondering why it is behaving this way? Is it because its on a Debian system instead of Windows?