久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Python 3 ftplib 錯誤“名稱或服務未知"

Python 3 ftplib error quot;Name or service not knownquot;(Python 3 ftplib 錯誤“名稱或服務未知)
本文介紹了Python 3 ftplib 錯誤“名稱或服務未知"的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試使用 Python 3 的 ftplib 庫從 FTP 服務器下載文件.

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

這里是相關(guān)代碼-

ftp = ftplib.FTP("ftp://library.daisy.org:21/User_****/Wise & Otherwise-22.zip") 
ftp.login("xxxxx", "xxxxxxx") 
ftp.cwd(path)
ftp.retrbinary("RETR " + filename, open(filename, 'wb').write)
ftp.quit()

當我嘗試運行腳本時,會顯示以下錯誤-

When I try to run the script the following error shows up-

Traceback (most recent call last):
  File "reader.py", line 604, in <module>
    sp.process_user_choice()
  File "reader.py", line 72, in process_user_choice
    self.download_books()   File "reader.py", line 324, in download_books
    ftp = ftplib.FTP(all_urls[response]) 
  File "/usr/lib/python3.5/ftplib.py", line 118, in __init__
    self.connect(host)
  File "/usr/lib/python3.5/ftplib.py", line 153, in connect
    source_address=self.source_address)
  File "/usr/lib/python3.5/socket.py", line 694, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

<小時>

一些筆記-


Some notes-

  1. 我有正確的 URL 和憑據(jù)
  2. 我在代理服務器后面

推薦答案

FTP 構(gòu)造函數(shù)的 host 參數(shù),顧名思義,只接受一個主機名,例如 <代碼>library.daisy.org.你傳入的是一個完整的 URL.

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.

這是正確的:

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

<小時>

完整路徑轉(zhuǎn)到 RETR 命令的參數(shù):

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.

這里有很多關(guān)于這部分的問題.但是您沒有告訴我們您使用的是哪種代理,所以我不能更具體.

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.

這篇關(guān)于Python 3 ftplib 錯誤“名稱或服務未知"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Why I cannot make an insert to Python list?(為什么我不能插入 Python 列表?)
Insert a column at the beginning (leftmost end) of a DataFrame(在 DataFrame 的開頭(最左端)插入一列)
Python psycopg2 not inserting into postgresql table(Python psycopg2 沒有插入到 postgresql 表中)
list extend() to index, inserting list elements not only to the end(list extend() 索引,不僅將列表元素插入到末尾)
How to add element in Python to the end of list using list.insert?(如何使用 list.insert 將 Python 中的元素添加到列表末尾?)
TypeError: #39;float#39; object is not subscriptable(TypeError:“浮動對象不可下標)
主站蜘蛛池模板: 黄色片av | 久久成人免费视频 | 在线观看免费毛片 | 91亚洲国产成人久久精品网站 | 成人在线观看免费 | 91在线第一页 | 九色av | 天堂三级 | 国产不卡在线播放 | 久草在线青青草 | 一级a性色生活片久久毛片 一级特黄a大片 | 国产精品a久久久久 | 国产欧美精品一区二区色综合朱莉 | 一级片网址 | 男女午夜激情视频 | 91 视频网站 | 久久精品国产久精国产 | 久久er99热精品一区二区 | 成人久久久久 | 免费看国产一级特黄aaaa大片 | 蜜月aⅴ国产精品 | 成人网在线观看 | 亚洲精品视频在线 | 久久综合国产精品 | www.亚洲| 一级片在线观看 | 亚洲人成人一区二区在线观看 | www.国产精 | 久久国产精品99久久久久久丝袜 | 国产99视频精品免费播放照片 | 欧美亚州 | 日本在线免费看最新的电影 | 国产精品一区二区三区四区 | 日韩三级免费观看 | 亚洲综合国产精品 | 亚洲在线| 色婷婷综合久久久中字幕精品久久 | a级大毛片| 91精品久久久久久久久久 | 男人的天堂中文字幕 | 日韩精品免费一区 |