Sample code for 30+ languages & platforms
Chilkat2-Python

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

# ------------------------------------------------------------------------
# The NextEntry method is deprecated.
# See below or code showing how to rewrite using EntryAt/GetNext

zip = chilkat2.Zip()

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.LastMethodSuccess == False):
    print("This zip archive is empty.")
    sys.exit()

finished = False
while finished == False :

    if (entry.IsDirectory == False):
        print(entry.FileName)
    else:
        print("(directory) " + entry.FileName)

    # next is a CkZipEntry
    next = entry.NextEntry()
    if (entry.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 = chilkat2.ZipEntry()
zip.EntryAt(0,ze)

entryValid = True
while entryValid == True :

    if (ze.IsDirectory == False):
        print(ze.FileName)
    else:
        print("(directory) " + ze.FileName)

    entryValid = ze.GetNext()

zip.CloseZip()