Jul-18-2021, 08:35 AM
def upload_script(routerIP, File_Name_To_Upload): UploadOk = "Problem" ftp = FTP(routerIP, timeout=60) try: ftp.login(user=username, passwd=password) except error_perm as msg: print(f"FTP error: {msg}") return "Wrong User or Password" except Exception as e1: print(e1) print("Error in FTP Login!") return "Unknown Error" else: try: ftp.storbinary('STOR ' + nameOnRouter, open(filename, 'rb')) UploadOk = "OK" return "FTP success" except Exception as e: print('my error') print(e) UploadOk = "Problem" return "FTP Error " + str(e) finally: print('done with ' + nameOnRouter + " status " + UploadOk)this is my fucntion that should read the files and upload them using FTP