I've received following error when trying to execute script to copy specific file from remote server to jumphost and then to my local computer.
Traceback (most recent call last):
File "list_files.py", line 34, in <module>
stdin, stdout, stderr = p.exec_command('sshpass -p %s scp -r hostname:/directory/' + list[file_number] + ' ' + '/desired_directory' % (password))
TypeError: not all arguments converted during string formatting
stdin, stdout, stdeer = p.exec_command('sshpass -p %s ssh hostname ls /directory/' % (password))
for line in stdout:
if line:
list.append(line)
i = 0
for x in list:
print(str(i) + '. ' + x)
i+=1
file_number = input("Type log file number you would like to get: ")
stdin, stdout, stderr = p.exec_command('sshpass -p %s scp -r hostname:/directory/' + list[file_number] + ' ' + '/desired_directory/downloaded_file_name' % (password))
I've already tried change syntax to the ${0} instead of %s but it didn't help. I assume problem is in list[file_number] not in %s.