問題描述
我正在嘗試在 python 中創建一個非常基本的 FTP 客戶端,并且在前幾行代碼中我已經遇到了問題
I am trying to make a very basic FTP client in python, and within the first few lines of code I have already run into a problem
我的代碼:
from ftplib import FTP
ftp = FTP('ftp.mysite.com')
有了這段代碼,并且使用了無數不同的 url,我總是會得到同樣的錯誤:
With this code, and with countless different urls used, I will always get the same error:
gaierror: [Errno 11004] getaddrinfo failed
推薦答案
其實就是你的電腦無法解析你給它的域名.這里提供了詳細的錯誤描述.嘗試使用眾所周知的有效 FTP 進行測試(例如 ftp.microsoft.com
).然后嘗試使用某個 FTP 客戶端打開您嘗試訪問的 FTP.
Actually, this means that your computer can't resolve the domain name that you gave it. A detailed error description is available here. Try to use a well-known working FTP to test (e.g. ftp.microsoft.com
). Then try to open the FTP you're trying to access with some FTP client.
這篇關于Python ftplib 連接錯誤(gaierror)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!