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

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

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

問題描述

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

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 拋出此錯(cuò)誤:

錯(cuò)誤:
[WinError 10060] 連接嘗試失敗,因?yàn)檫B接的一方在一段時(shí)間后沒有正確響應(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

<小時(shí)>

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


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ā)送了帶有不可路由地址的被動(dòng)回復(fù)

Status: Server sent passive reply with unroutable address

以上表示FTP服務(wù)器配置錯(cuò)誤.它將其內(nèi)部網(wǎng)絡(luò) IP 發(fā)送到外部網(wǎng)絡(luò)(發(fā)送到客戶端 - FileZilla 或 Python ftplib),在該位置它是無效的.FileZilla 可以檢測到并自動(dòng)回退到服務(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:“浮動(dòng)對象不可下標(biāo))
主站蜘蛛池模板: 久草福利资源 | 国产成人精品免费视频 | 一级欧美一级日韩 | 久久国产精品一区二区 | 黄色片91 | 亚洲一级免费视频 | 永久免费看mv网站入口亚洲 | 国产成人免费 | 国产一区二区中文字幕 | 激情五月综合色婷婷一区二区 | 精品久久久久久久久久久久久久久久 | 亚洲色吧 | 伊人天堂网 | 国产普通话对白 | 五月激情久久 | 亚洲爱爱网 | 大尺度做爰呻吟舌吻网站 | 欧美精品成人 | 另类小说第一草 | 久久久久久中文字幕 | 十八岁毛片 | 成人玩具h视频 | 久久久久a| 韩日中文字幕 | 天天草天天干 | 亚洲精品一区二区三区精华液 | 日本视频一区二区三区 | 精品视频免费在线观看 | 免费精品视频 | 免费成人在线观看 | 欧美精品亚洲 | 亚洲成人三级 | 亚洲欧美日本在线 | 日本福利在线 | 狠狠的操 | 福利网站在线观看 | 在线一级片 | 久久视频免费在线观看 | 欧美成人性生活视频 | 日韩福利视频 | 操操av |