当我使用 pysftp-0.2.8 将大文件发送到我的 sftp 服务时。总是报同样的错误:paramiko.ssh_exception.SSHException: Expecting packet from (31,), got 94
文件1.5G左右,500M传输就坏了。代码在这里:
import pysftp
upftp=FTP(host=ftp_ip, user=ftp_name, passwd=ftp_passwd, acct=ftp_port, timeout=None)
...
try:
upftp.storbinary('STOR %s'%obj[2], fp, 8192, self.callpecent)
except Exception as error:
fp.close()
self.endit(upftp, 1, '%s,%s'%(obj[2],error), '%s,%s'%(obj[2],error)
)
此处的错误消息:
2015-03-24 09:43:05 DEBUG - Rekeying (hit 32729 packets, 536900100 bytes sent)
2015-03-24 09:43:05 DEBUG - Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
2015-03-24 09:43:05 DEBUG - using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
2015-03-24 09:43:05 ERROR - Exception: Expecting packet from (31,), got 94
2015-03-24 09:43:05 ERROR - Traceback (most recent call last):
2015-03-24 09:43:05 ERROR - File "D:\Python34\lib\site-packages\paramiko-1.14.0-py3.4.egg\paramiko\transport.py", line 1435, in run
2015-03-24 09:43:05 ERROR - raise SSHException('Expecting packet from %r, got %d' % (self._expected_packet, ptype))
2015-03-24 09:43:05 ERROR - paramiko.ssh_exception.SSHException: Expecting packet from (31,), got 94
2015-03-24 09:43:05 ERROR -
2015-03-24 09:43:05 DEBUG - Dropping user packet because connection is dead.
2015-03-24 09:43:05 DEBUG - [chan 1] close(b'd40b000000000000')
2015-03-24 09:43:05 INFO - [chan 1] sftp session closed.
谢谢您的回答 !