I have a zip file called "main.zip". Inside that, I have another zip called "meta" which does not have the ".zip" extension. I want to open the "meta" zip file which contains lots of text files. But when I try to open the "meta" zip file, I get an error saying zipfile.BadZipfile: File is not a zip file
. Below is my code:
zf = zipfile.ZipFile(inputZipFile, 'r')
print(zf.namelist()) # [u'meta']
zf2 = zipfile.ZipFile(zf.open('meta')) # throws error
I can't extract and open "meta" because I want to do this entirely in memory without writing to the disk.
My ultimate goal is to modify one of the text files and output a new zip.