Cannot connect to FTP server
Question: I'm not able to connect to FTP server getting below error :-

    
    
     vmware@localhost ~]$ python try_ftp.py 
    Traceback (most recent call last):
      File "try_ftp.py", line 5, in <module>
        f = ftplib.FTP('ftp.python.org')
      File "/usr/lib/python2.6/ftplib.py", line 116, in __init__
        self.connect(host)
      File "/usr/lib/python2.6/ftplib.py", line 131, in connect
        self.sock = socket.create_connection((self.host, self.port), self.timeout)
      File "/usr/lib/python2.6/socket.py", line 567, in create_connection
        raise error, msg
    socket.error: [Errno 101] Network is unreachable
    

I'm writing a very simple code

    
    
    import ftplib
    f = ftplib.FTP('ftp.python.org')
    f.login('anonymous','sausaxen@xyz.com')
    f.dir()
    f.retrlines('RETR motd')
    f.quit()
    

I checked my proxy settings , but it is set to "System proxy setttings"

Please suggest what should I do.

Thanks, Sam


Answer: 
    [torxed@archie ~]$ telnet ftp.python.org 21
    Trying 82.94.164.162...
    Connection failed: Connection refused
    Trying 2001:888:2000:d::a2...
    telnet: Unable to connect to remote host: Network is unreachable
    

It's not as much the hostname that's bad (ping works you mentioned) but the
default port of 21 is bad. Or they're not running a standard FTP server on
that host at all but rather they're using HTTP as a transport:
<https://www.python.org/ftp/python/>

Try against **ftp.acc.umu.se** instead.

    
    
    [torxed@archie ~]$ python
    Python 3.3.5 (default, Mar 10 2014, 03:21:31) 
    [GCC 4.8.2 20140206 (prerelease)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ftplib
    >>> f = ftplib.FTP('ftp.acc.umu.se')
    >>> 
    

