2013-08-12 6 views
6

निम्नलिखित कोड:Paramiko को जन्म देती है "SFTPError: कचरा पैकेट प्राप्त"

t = paramiko.Transport((hostname, port)) 
    t.connect(username=username, password=password) 
    sftp = t.open_sftp_client() 

इस अपवाद बढ़ा:

Traceback (most recent call last): 
File "C:\Users\elqstux\workspace\WxPython\FetcchFile.py", line 41, in <module> 
sftp = t.open_sftp_client() 
File "C:\Python27\lib\site-packages\paramiko\transport.py", line 845, in  open_sftp_client 
return SFTPClient.from_transport(self) 
File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 106, in from_transport 
return cls(chan) 
File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 87, in __init__ 
server_version = self._send_version() 
File "C:\Python27\lib\site-packages\paramiko\sftp.py", line 108, in _send_version 
t, data = self._read_packet() 
File "C:\Python27\lib\site-packages\paramiko\sftp.py", line 179, in _read_packet 
raise SFTPError('Garbage packet received') 
SFTPError: Garbage packet received 

मेरे मेजबान के आईपी 147.214.16.150, मैं कंसोल में परीक्षण करने के लिए इस आदेश का उपयोग का उपयोग करें:

esekilvxen245 [11:03am] [/home/elqstux] -> sftp 147.214.16.150 
Connecting to 147.214.16.150... 

These computer resources, specifically Internet access and E-mail, are 
provided for authorized users only. For legal, security and cost 
reasons, utilization and access of resources are monitored and recorded 
in log files. All information (whether business or personal) that is 
created, received, downloaded, stored, sent or otherwise processed can 
be accessed, reviewed, copied, recorded or deleted by Ericsson, in 
accordance with approved internal procedures, at any time if deemed 
necessary or appropriate, and without advance notice. Any evidence of 
unauthorized access or misuse of Ericsson resources may result in 
disciplinary actions, including termination of employment or assignment, 
and could subject a user to criminal prosecution. Your use of Ericsson's 
computer resources constitutes your consent to Ericsson's Policies and 
Directives, including the provisions stated above. 

IF YOU ARE NOT AN AUTHORIZED USER, PLEASE EXIT IMMEDIATELY 

Enter Windows Password: 
Received message too long 1131770482 
+0

आप एक वास्तविक SFTP-सक्षम होस्ट से कनेक्ट करते हैं: मैं इसे अपने .bashrc फाइल को बदलने के द्वारा तय हो गई? क्या आपने 'sftp' कमांड-लाइन टूल का उपयोग करके इसे कनेक्ट करने का प्रयास किया है? –

+0

@MartijnPieters मैं इसे कमांड लाइन में परीक्षण करता हूं, आउटपुट 'संदेश बहुत लंबा 1131770482' प्राप्त होता है। – BlackMamba

+0

फिर आपको * उस * भाग का निदान करने की आवश्यकता है; यह एक पायथन समस्या नहीं है। आपका लक्ष्य सर्वर गलत व्यवहार कर रहा है। –

उत्तर

5

मुझे एक ही समस्या थी, और पाया कि यह एक कार्यक्रम 'जीवीएम' से आउटपुट के कारण था।

#THIS MUST BE AT THE END OF THE FILE FOR GVM TO WORK!!! 
#[[ -s "/home/micron/.gvm/bin/gvm-init.sh" ]] && source "/home/micron/.gvm/bin/gvm-init.sh" <== commented this out. 
+3

यह सही है, जो कुछ भी लॉगिन पर _stdout_ को लिखता है वह ftp प्रोटोकॉल को गड़बड़ कर देगा। –

संबंधित मुद्दे