i have error then use ftplib

Леонов Алексей aleonov at oldham.utk.ru
Thu Mar 30 09:35:30 CEST 2006


Hello!
I use this code:

from ftplib import FTP
def handleDownload(block):
    file.write(block)
    print "."
    
file = open('1', 'wb')
ftp = FTP('ftp.utk.ru')
ftp.set_pasv(1)
ftp.login()
ftp.retrlines('LIST')
ftp.cwd('users/video/Anime/Beyond the Clouds')
ftp.retrbinary('RETR "[Triad]_Beyond_the_Clouds_CD1.srt"', handleDownload, 1024, 600 )

ftp.quit()
file.close()


and have this error message.

Traceback (most recent call last):
  File "ftp.py", line 10, in ?
    ftp.retrlines('LIST')
  File "C:\Python24\lib\ftplib.py", line 396, in retrlines
    conn = self.transfercmd(cmd)
  File "C:\Python24\lib\ftplib.py", line 345, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "C:\Python24\lib\ftplib.py", line 324, in ntransfercmd
    conn.connect(sa)
  File "<string>", line 1, in connect
socket.error: (10065, 'No route to host')


Programs that not use Python connect to the server ok.
Where I do mistake?

   Best regards
           nazarianin




More information about the Python-list mailing list