Skip to content Skip to sidebar Skip to footer

Ftplib Error Socket.gaierror: [errno 8] Nodename Nor Servname Provided, Or Not Known

I'm trying to download a file from an FTP server using FTPlib but i keep getting the error below. I tried several methods found on SO namely editing the etc/host file and adding th

Solution 1:

ftp = FTP('myftpurl')

It is not clear what myftpurl actually contains in your specific code. But given its name I assume that you've tried something like ftp://example.com. Only, as clearly documentedFTP(...) does not expect a URL but instead a hostname or IP, i.e. FTP('example.com') and not FTP('ftp://example.com').

Given a URL like you probably do will result in treating that URL as hostname, i.e. doing a lookup for the hostname ftp://example.com. Since such a host does not exist you get an error.

Post a Comment for "Ftplib Error Socket.gaierror: [errno 8] Nodename Nor Servname Provided, Or Not Known"