【发布时间】:2012-06-27 05:47:44
【问题描述】:
我遇到了 paramiko 的问题,当我尝试从远程服务器获取文件时,它给了我IOError: [Errno 2] No such file。这是我的代码:
# set up a transport object t (using an rsa key), which connected successfully
>>> t.is_active()
True
>>> sftp = paramiko.SFTPClient.from_transport(t)
>>> files = sftp.listdir() # files holds the list ['canceled', 'downloaded', 'FILE.06222012.TXT']
>>> sftp.get(files[2], '.')
IOError: [Errno 2] No such file
但是,当我在命令行上连接到 sftp 时(作为我打开 python repl 的同一用户)我可以获取文件。有什么想法吗?
编辑:我在交互式 sftp 提示符中发现这篇文章似乎是我遇到的问题https://bugs.launchpad.net/paramiko/+bug/492238:
sftp> df -hi
Server does not support statvfs@openssh.com extension
这个错误来自 2009 年,并没有被关闭(但我使用的是最新的 paramiko 1.7.7.1)。有人知道解决方法吗?我可以强制 paramiko 只做与普通 sftp get 等效的操作,而不尝试检查文件完整性吗?
【问题讨论】: