Python 3 ftplib error “Name or service not known”

前端 未结 1 1436
猫巷女王i
猫巷女王i 2021-01-14 21:24

I am trying to download a file from FTP server using ftplib library of Python 3.

Here is the relevant code-

ftp = ftplib.FTP(\"ftp://library.daisy.or         


        
相关标签:
1条回答
  • 2021-01-14 22:20

    The host argument of FTP constructor takes, as the name suggests, a hostname only, like library.daisy.org. You are passing in a whole URL.

    This is correct:

    ftp = ftplib.FTP("library.daisy.org")
    

    The full path goes to an argument of the RETR command:

    ftp.retrbinary("RETR User_****/Wise & Otherwise-22.zip", open(filename, 'wb').write)
    

    As you are connecting via proxy, you have to cater for that too.

    There are lot of questions here covering that part. But you didn't tell us what kind of proxy you are using, so I cannot be more specific.

    0 讨论(0)
提交回复
热议问题