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

無法使用 ftplib 列出 FTP 目錄 - 但 FTP 客戶端可以

Cannot list FTP directory using ftplib – but FTP client works(無法使用 ftplib 列出 FTP 目錄 - 但 FTP 客戶端可以工作)
本文介紹了無法使用 ftplib 列出 FTP 目錄 - 但 FTP 客戶端可以工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在嘗試連接到 FTP,但我無法運行任何命令.

I'm trying to connect to an FTP but I am unable to run any commands.

ftp_server = ip
ftp_username = username
ftp_password = password

ftp = ftplib.FTP(ftp_server)
ftp.login(ftp_username, ftp_password)
'230 Logged on'

ftp.nlst()

ftp.nlst 拋出此錯誤:

錯誤:
[WinError 10060] 連接嘗試失敗,因為連接的一方在一段時間后沒有正確響應(yīng),或者連接的主機(jī)沒有響應(yīng),建立連接失敗

Error:
[WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

<小時>

我已經(jīng)使用 FileZilla 測試了連接(在同一臺機(jī)器上運行),它工作正常.


I've tested the connection using FileZilla (running on the same machine) and it works fine.

這是 FileZilla 日志:

This is FileZilla log:

Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Status: Logged in Status: Retrieving directory listing...
Status: Server sent passive reply with unroutable address. Using server address instead.
Status: Directory listing of "/" successful

推薦答案

狀態(tài):服務(wù)器發(fā)送了帶有不可路由地址的被動回復(fù)

Status: Server sent passive reply with unroutable address

以上表示FTP服務(wù)器配置錯誤.它將其內(nèi)部網(wǎng)絡(luò) IP 發(fā)送到外部網(wǎng)絡(luò)(發(fā)送到客戶端 - FileZilla 或 Python ftplib),在該位置它是無效的.FileZilla 可以檢測到并自動回退到服務(wù)器的原始 IP 地址.

The above means that the FTP server is misconfigured. It sends its internal network IP to outside network (to the client – FileZilla or Python ftplib), where it is invalid. FileZilla can detect that and automatically fall back to the original IP address of the server.

Python ftplib 不做這種檢測.

Python ftplib does not do this kind of detection.

您需要修復(fù)您的 FTP 服務(wù)器以返回正確的 IP 地址.

You need to fix your FTP server to return the correct IP address.

如果修復(fù)服務(wù)器不可行(它不是你的并且管理員不合作),你可以通過覆蓋 FTP.makepasv 讓 ftplib 忽略返回的(無效的)IP 地址并使用原始地址:

If it is not feasible to fix the server (it's not yours and the admin is not cooperative), you can make ftplib ignore the returned (invalid) IP address and use the original address instead by overriding FTP.makepasv:

class SmartFTP(FTP):
    def makepasv(self):
        invalidhost, port = super(SmartFTP, self).makepasv()
        return self.host, port

ftp = SmartFTP(ftp_server)

# the rest of the code is the same


另一種解決方案可能是使用 IPv6.請參閱 Python 3.8.5 FTPS 連接.

對于具有類似后果的不同問題,請參閱 vsftpd 返回 0,0,0,0 以響應(yīng) PASV.

這篇關(guān)于無法使用 ftplib 列出 FTP 目錄 - 但 FTP 客戶端可以工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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:“浮動對象不可下標(biāo))
主站蜘蛛池模板: 欧美成人在线免费 | 中文成人无字幕乱码精品 | 国产jizz女人多喷水99 | www精品美女久久久tv | 国产乱码精品1区2区3区 | 亚洲美女天堂网 | 搞av.com| 国产一区二区三区高清 | 亚洲国产aⅴ精品 | 一级毛片在线播放 | 色呦呦网站 | 男女视频免费 | 日日夜夜天天 | 国产精品夜夜夜一区二区三区尤 | 国产精品亚洲综合 | 成人免费在线小视频 | 国产精品一区2区 | 国产精品一区二区不卡 | 国产精品日日摸夜夜添夜夜av | 国产精品久久久久久久7电影 | 久久精品视频网站 | 亚洲成人精品一区 | 国产成人久久精品一区二区三区 | 一区精品在线观看 | 亚洲人成一区二区三区性色 | 日韩成人免费av | 欧美亚洲视频 | 不卡的av在线| 国产精品成人一区二区三区夜夜夜 | 中文字幕在线第一页 | 亚洲成人高清 | 免费一级黄色录像 | 久久免费精品视频 | 中文字幕在线观看一区 | 亚洲精品国产成人 | 日本五月婷婷 | 狠狠亚洲 | 一区二区三区av | 日韩精品无码一区二区三区 | 日本欧美国产在线观看 | 欧美精品在线免费观看 |