3

谁能告诉我为什么会出现以下错误:

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'

我在登录 Ubuntu 10.10 机器的 Windows 7(作为管理员)机器上使用 Python 2.7。这是我正在使用的非常直接的脚本:

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()
4

1 回答 1

5

尝试进行以下更改

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

将其修改为

localpath = 'C:\remote\my.log'
sftp.get(filepath, localpath)
于 2014-08-18T21:05:19.403 回答