[Tutor] ftp socket.error

richard kappler richkappler at gmail.com
Fri Sep 11 18:00:12 CEST 2015


I can connect via ftp, but when I try to send a file, I get a no route to
host error, I don't understand.

code:

>>> import ftplib
>>> from ftplib import FTP
>>> fBOT = FTP()
>>> oldfile = '/home/test/DataFeed/input/images/BOT/1.jpg'
>>> newfile = 'new.jpg'
>>> oldfile = open('/home/test/DataFeed/input/images/BOT/1.jpg', 'rb')
>>> fBOT.connect('192.168.2.23', 2021)
'220 Service ready for new user.'
>>> fBOT.login('BOT', 'sick')
'230 User logged in, proceed.'
>>> fBOT.storbinary('STOR  newfile', oldfile)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/ftplib.py", line 452, in storbinary
    conn = self.transfercmd(cmd)
  File "/usr/lib64/python2.6/ftplib.py", line 360, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "/usr/lib64/python2.6/ftplib.py", line 326, in ntransfercmd
    conn = socket.create_connection((host, port), self.timeout)
  File "/usr/lib64/python2.6/socket.py", line 567, in create_connection
    raise error, msg
socket.error: [Errno 113] No route to host

Any ideas?

regards, Richard

-- 

All internal models of the world are approximate. ~ Sebastian Thrun


More information about the Tutor mailing list