我正在努力解决这个问题,但我遇到了类似的问题,但我无法理解。问题似乎与paramiko sftp.put( localpath )有关。我知道我做错了可以弄清楚如何解决它。请注意我已经大量修改了原始代码。正如我之前所说,我遇到了类似的问题,但我不明白决议。
import paramiko
pk = paramiko.RSAKey.from_private_key(private_key_file)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("hostname", username = "test", password = "password", pkey =
pk)
sftp = ssh.open_sftp()
#some files. previous_week from week number generator
PC_Rank = 'some_file_WK%s.csv' %previous_week
PC_SA = 'WK%s_some_other_file.csv' %previous_week
#Python list
Files = [PC_Rank, PC_SA]
#windows server file location
local_path = "\\10.245.102.21\Files\#GIS Files\#csv_output\delete"
#Defining remote directory
remote_path = "Images/Staging/coverage_checker"
sftp.chdir(remote_path)
for filename in Files:
sftp.put(local_path, filename)