[Tutor] Ftplib error using dir()
WEISS, MARK (NB)
mw5858 at sbc.com
Fri Oct 8 20:55:32 CEST 2004
Hello Group,
I am trying to build a FTP client and I am getting a 'connection
refused' error when I call the code listed below. I can login fine (in
my script), and I connect through a command prompt using the ftp command
(Win2K) I can list the files in the remote directory. Also, to further
confuse the matter I can run this code against a local ftp server and
return the list of files.
def getListFiles(ftp):
# return a LIST of the directory contents
dataList = []
try:
ftp.dir(dataList.append)
except socket.error, (errno, strerror):
print "Error code(%d), Error Message: %s " % (errno, strerror)
# - raises - 'Error code(10061), Error Message: Connection
refused'
except:
print sys.exc_info()
return dataList
Any ideas on why this is failing or to better isolate the error would be
greatly appreciated.
Thanks!
-mark
More information about the Tutor
mailing list