Python Pysftp错误 [英] Python Pysftp Error

查看:100
本文介绍了Python Pysftp错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码:

import pysftp 
s = pysftp.Connection(host='test.rebex.net', username='demo', password='password') 
data = s.listdir() 
s.close() 
for i in data: 
    print i

尝试使用pysftp连接到SFTP服务器时出现错误.

I'm getting an error trying to connect to a SFTP server using pysftp.

这应该很简单,但是我得到以下错误:

This should be straight forward enough but I get the error below:

Traceback (most recent call last):
  File "/Users/gavinhinfey/Documents/Python Files/sftp_test.py", line 3, in <module>
    s = pysftp.Connection(host='test.rebex.net', username='demo', password='password')
  File "build/bdist.macosx-10.6-intel/egg/pysftp.py", line 55, in __init__
  File "build/bdist.macosx-10.5-intel/egg/paramiko/transport.py", line 303, in __init__
paramiko.SSHException: Unable to connect to test.rebex.net: [Errno 60] Operation timed out
Exception AttributeError: "'Connection' object has no attribute '_tranport_live'" in <bound     method Connection.__del__ of <pysftp.Connection object at 0x101a5a810>> ignored

我尝试使用不同版本的python(主要是2.7),安装了所有依赖项,并尝试了许多sftp连接. 我正在使用OS X 10.9.1.

I've tried using different versions of python (mostly 2.7), I have all dependencies installed and I tried numerous sftp connections. I'm using OS X 10.9.1.

推荐答案

该初始错误似乎是与远程服务器连接时出现的问题(SSHException).第二个(AttributeError)来自连接失败时发生的代码错误.在最新版本的pysftp中已修复

That initial error appears to be a problem connecting with the remote server (SSHException). The second (AttributeError), is from a bug in the code that occurs when the connection fails. It is fixed in the latest version of pysftp

https://pypi.python.org/pypi/pysftp

pip install -U pysftp

是你的朋友.

这篇关于Python Pysftp错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆