I implemented a FTP Server in Python using pyftpdlib.ftpserver
This works fine with mput/put operations but fails with mget/get. Following exception is thrown:
[] 10.203.200.136:62408連接 'MGET' 拋出異常。 10.203.200.136:62408 ==> 220 pyftpdlib 0.5.2就緒。 10.203.200.136:62408 < == USER用戶 10.203.200.136:62408 ==> 331用戶名ok,發送密碼。 10.203.200.136:62408 < == PASS ** 10.203.200.136:62408 ==> 230登錄成功。 [user] @ 10.203.200.136:62408用戶用戶登錄 10.203.200.136:62408 < == TYPE A 10.203.200.136:62408 ==> 200類型設置爲:ASCII。 10.203.200.136:62408 < == PORT 10,203,200,136,243,206 10.203.200.136:62408 ==> 200建立主動數據連接。 10.203.200.136:62408 < == NLST RS.pcap [user] @ 10.203.200.136:62408 OK NLST「/RS.pcap」。開始轉移。 10.203.200.136:62408 ==> 125數據連接已經打開。開始轉移。 10.203.200.136:62408 ==> 226傳輸完成。 10.203.200.136:62408 < == TYPE A 10.203.200.136:62408 ==> 200 Type設置爲:ASCII。 10.203.200.136:62408 < == PORT 10,203,200,136,243,208 10.203.200.136:62408 ==> 200建立主動數據連接。 10.203.200.136:62408 < == RETR RS.pcap [user] @ 10.203.200.136:62408 OK RETR「/RS.pcap」。下載開始。 10.203.200.136:62408 ==> 125數據連接已經打開。開始轉移。 10.203.200.136:62408 ==> 426內部錯誤;轉移中止。FTPServer的在Python上
Traceback (most recent call last):
File "C:\Python31\lib\asynchat.py", line 244, in initiate_send
data = buffer(first, 0, obs)
File "C:\Python31\lib\asynchat.py", line 56, in buffer
memoryview(obj)
TypeError: cannot make memory view because object does not have the buffer interface
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python31\lib\pyftpdlib\ftpserver.py", line 2077, in push_dtp_data
self.data_channel.push_with_producer(data)
File "C:\Python31\lib\asynchat.py", line 211, in push_with_producer
self.initiate_send()
File "C:\Python31\lib\asynchat.py", line 246, in initiate_send
data = first.more()
File "C:\Python31\lib\pyftpdlib\ftpserver.py", line 1143, in more
return bytes(data, BYTES_ENCODING)
TypeError: encoding or errors without a string argument
現在asynchat.py(其在內部調用),在initiate_send,緩衝器被稱爲會拋出時memoryview(OBJ)是進行異常; obj是FileProducer類型的對象。
任何人都可以請建議可能的錯誤是什麼?在Python庫中有問題嗎?如何解決它?
如何在Python 3.1中使用pyftpdlib? – Rajat