簡體   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

誰能告訴我為什么會出現以下錯誤:

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

嘗試進行以下更改

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

將其修改為

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM