我试图理解为什么我会收到“权限被拒绝”的消息使用 paramiko 1.7.6 时出错
谁能告诉我为什么会出现以下错误:
Traceback (most recent call last):
File "C:\Python27\connect.py", line 22, in <module>
sftp.get(filepath, localpath)
File "C:\Python27\lib\site-packages\paramiko-1.7.6-py2.7.egg\paramiko\sftp_client.py", line 603, in get
fl = file(localpath, 'wb')
IOError: [Errno 13] Permission denied: 'C:\\remote'
我在 Windows 7(以管理员身份)计算机上使用 Python 2.7 登录 Ubuntu 10.10 计算机。这是我正在使用的非常简单的脚本:
import paramiko
import os
paramiko.util.log_to_file('c:\Python27\paramiko-wininst.log')
host = '192.168.1.14'
port = 22
transport = paramiko.Transport((host,port))
password = 'xxxxxx'
username = 'username'
transport.connect(username = username, password = password)
sftp = paramiko.SFTPClient.from_transport(transport)
filepath = '/home/my.log'
localpath = 'C:\\remote'
sftp.get(filepath, localpath)
sftp.close()
transport.close()
Can anyone tell me why I'm getting the following error:
Traceback (most recent call last):
File "C:\Python27\connect.py", line 22, in <module>
sftp.get(filepath, localpath)
File "C:\Python27\lib\site-packages\paramiko-1.7.6-py2.7.egg\paramiko\sftp_client.py", line 603, in get
fl = file(localpath, 'wb')
IOError: [Errno 13] Permission denied: 'C:\\remote'
I'm using Python 2.7 on a Windows 7 (as administrator) machine logging into an Ubuntu 10.10 machine. Here is the, very straight forward, script that I'm using:
import paramiko
import os
paramiko.util.log_to_file('c:\Python27\paramiko-wininst.log')
host = '192.168.1.14'
port = 22
transport = paramiko.Transport((host,port))
password = 'xxxxxx'
username = 'username'
transport.connect(username = username, password = password)
sftp = paramiko.SFTPClient.from_transport(transport)
filepath = '/home/my.log'
localpath = 'C:\\remote'
sftp.get(filepath, localpath)
sftp.close()
transport.close()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试进行以下更改
修改为
Try to make the following change
modify it to