The file download works well with individual files but when I run it in a for loop to download multiple files at once, it keeps crashing after downloading the first file. I tried multiple things but the result is same, the program stops after the first download with no error.
def store_files_name(fname):
file_names.append(fname)
def store_dir_name(dirname):
dir_names.append(dirname)
def store_other_file_types(name):
un_name.append(name)
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
conn = pysftp.Connection('', username='', password='', private_key=".ppk", cnopts=cnopts)
sftp.walktree("",store_files_name,store_dir_name,store_other_file_types,recurse=True)
for f in file_names:
print(f)
conn.get("/"+f)