I am hoping someone might point me in the right direction. I am still very newbie with coding and python. I am currently trying to open a zip file and I keep getting "file is not a zip file". I have checked using “file” in terminal and it shows as a zip along with I know the file is created as a zip. I am able to unpack the file with no issue. Any help on how to resolve this is appreciated. In my google searches I haven't come across anything.
import zipfile
archive_location = <path_to_archive>
f = zipfile.ZipFile(archive_location, 'r')
for filename in f.namelist():
print 'File', filename
File "unarchive.py", line 15, in <module>
f = zipfile.ZipFile(archive_location, 'r')
File "/usr/lib/python2.6/zipfile.py", line 696, in __init__
self._GetContents()
File "/usr/lib/python2.6/zipfile.py", line 716, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.6/zipfile.py", line 728, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file