python文件传输库_使用Python库Parami将文件从本地服务器传输到另一个服务器

我想将一个文件从本地服务器(包含代码和文件)传输到远程服务器,最好使用ssh。代码如下:import paramiko

ssh = paramiko.SSHClient()

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh.connect('Servername', port = 135, username='username', password='password')

print "connected successfully!"

sftp = ssh.open_sftp()

print sftp

sftp.put('G:\TestDocument.txt','G:\TestDocument.txt' )

sftp.close()

print "copied successfully!"

ssh.close()

但我得到一个错误:No handlers could be found for logger "paramiko.transport"

Traceback (most recent call last): File

"C:/Python27/testtransfer.py", line 5, in

ssh.connect('Servername', port = 135, username='username', password='password') File

"C:\Python27\lib\site-packages\paramiko\client.py", line 392, in

connect

t.start_client(timeout=timeout) File "C:\Python27\lib\site-packages\paramiko\transport.py", line 545, in

start_client

raise e SSHException: Error reading SSH protocol banner

你能告诉我为什么我收到这个错误吗?我特意使用了端口135,因为目标服务器上的端口22是关闭的,135(以及其他端口)是打开的。在

您甚至可以建议使用Python将文件从一个服务器传输到另一个服务器的其他方法。在

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值