CkPython
CkPython
Transition from ZipEntry.NextEntry to ZipEntry.GetNext
Provides instructions for replacing deprecated NextEntry method calls with GetNext.Chilkat CkPython Downloads
import sys
import chilkat
success = False
# ------------------------------------------------------------------------
# The NextEntry method is deprecated.
# See below or code showing how to rewrite using EntryAt/GetNext
zip = chilkat.CkZip()
success = zip.OpenZip("qa_data/zips/xml_files.zip")
if (success != True):
print(zip.lastErrorText())
sys.exit()
# entry is a CkZipEntry
entry = zip.FirstEntry()
if (zip.get_LastMethodSuccess() == False):
print("This zip archive is empty.")
sys.exit()
finished = False
while finished == False :
if (entry.get_IsDirectory() == False):
print(entry.fileName())
else:
print("(directory) " + entry.fileName())
# next is a CkZipEntry
next = entry.NextEntry()
if (entry.get_LastMethodSuccess() == False):
finished = True
# entry is a CkZipEntry
entry = next
zip.CloseZip()
print("----")
# ------------------------------------------------------------------------
# Do the equivalent using EntryAt/GetNext.
success = zip.OpenZip("qa_data/zips/xml_files.zip")
ze = chilkat.CkZipEntry()
zip.EntryAt(0,ze)
entryValid = True
while entryValid == True :
if (ze.get_IsDirectory() == False):
print(ze.fileName())
else:
print("(directory) " + ze.fileName())
entryValid = ze.GetNext()
zip.CloseZip()