File upload through SFTP (Paramiko) in Python gives IOError: Failure

前端 未结 1 944
面向向阳花
面向向阳花 2021-01-06 12:16

Aim: I am trying to use SFTP through Paramiko in Python to upload files on server pc.

What I\'ve done: To test that functionality, I am using my localhost (127.0.0.

相关标签:
1条回答
  • 2021-01-06 12:37

    The second argument of SFTPClient.put (remotepath) is path to a file, not a folder.

    So use file_name instead of '.':

    ftp_client.put(local_path, file_name)
    

    ... assuming you are already in remote_path, as you call .chdir earlier.


    To avoid a need for .chdir, you can use an absolute path:

    ftp_client.put(local_path, remote_path + '/' + file_name) 
    
    0 讨论(0)
提交回复
热议问题