简体   繁体   English

我试图理解为什么在使用 paramiko 1.7.6 时会出现“Permission Denied”错误

[英]I'm trying to understand why I'm getting a “Permission Denied” error when using paramiko 1.7.6

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.我在 Windows 7 (作为管理员)机器上使用 Python 2.7 登录到 Ubuntu 10.10 机器。 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()

Try to make the following change尝试进行以下更改

localpath = 'C:\\remote'
sftp.get(filepath, localpath)

modify it to将其修改为

localpath = 'C:\remote\my.log'
sftp.get(filepath, localpath)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试使用 CSV 文件中的数据对饼图进行 plot 饼图,但出现错误,我不明白 - I'm trying to plot a pie chart using data from a CSV file but I'm getting an error I don't understand 不明白为什么我出现索引错误 - Don't understand why I'm getting an index error 权限被拒绝,因为我试图写入 tsv 文件 - Permission being denied as I'm trying to write to a tsv file 为什么在尝试使用 openpyxl python 读取单元格值时出现“权限被拒绝错误”? - Why am I getting a “Permission denied error” while trying to read a cell value using openpyxl python? 我正在尝试在虚拟环境中安装 django 但出现一些错误,我不明白它是怎么回事 - I'm trying to install django in virtual environment but getting some error and I don't understand what is it about 尝试安装scipy时出现奇怪的错误 - I'm getting a weird error when trying to install scipy 我在尝试从urlresolver导入保留时遇到错误 - I'm getting error when trying to import reserve from urlresolver 尝试编译Yolo时,出现包未找到错误 - When trying to Complie Yolo,I'm getting package not found error 为什么我在运行 workon 命令时出错? - Why I'm Getting error when I run workon command? 我正在尝试使用 oops 开发 tkinter 应用程序但收到此错误 - I'm trying to develop tkinter app using oops but getting this error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM