Sample code for 30+ languages & platforms
CkPython

Transition from SFtp.ReadDir to SFtp.ReadDirListing

Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

success = False

sftp = chilkat.CkSFtp()

# ...
# ...

handle = sftp.openDir(".")
# ...
# ...

# ------------------------------------------------------------------------
# The ReadDir method is deprecated:

# dirObj is a CkSFtpDir
dirObj = sftp.ReadDir(handle)
if (sftp.get_LastMethodSuccess() == False):
    print(sftp.lastErrorText())
    sys.exit()

# ...
# ...

# ------------------------------------------------------------------------
# Do the equivalent using ReadDirListing.
# Your application creates a new, empty SFtpDir object which is passed 
# in the last argument and filled upon success.

dirOut = chilkat.CkSFtpDir()
success = sftp.ReadDirListing(handle,dirOut)
if (success == False):
    print(sftp.lastErrorText())
    sys.exit()

# ...
# ...

sftp.CloseHandle(handle)