Python Paramiko, PermissionError: [Errno 13] Permission denied when get files from remote server

后端 未结 1 1981
-上瘾入骨i
-上瘾入骨i 2021-01-07 09:23
import paramiko, os
paramiko.util.log_to_file(\'E:\\Automation\\paramiko.log\')
from stat import S_ISDIR
host = \"xx.xx.xxx.xxx\"
port = 22
transport = paramiko.Tran         


        
1条回答
  •  清酒与你
    2021-01-07 10:17

    The second argument to SFTPClient.get is a path to a local file. While you seem to pass a path to a directory.

    Also, you should not use os.path.join on SFTP paths. os.path.join is for local paths. SFTP always uses forward slashes, while os.path.join uses local OS-specific separators (back slashes on Windows).

    sftp.get(path + '/' + file, os.path.join('E:\InsightImport\CSV_EXTRACT', file))
    

    0 讨论(0)
提交回复
热议问题