![]() |
Unable to upload file using FTP - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Unable to upload file using FTP (/thread-35854.html) |
Unable to upload file using FTP - korenron - Dec-23-2021 Hello, I have a stange problem I'm using this simple code: ftp = FTP('10.0.0.1', timeout=60) try: ftp.login(user='user', passwd='pass') 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: file_to_upload = open(filename, 'rb') ftp.storbinary('STOR test.txt', file_to_upload) UploadOk = "OK" return "FTP success" except Exception as e: print('my error') print(e) UploadOk = "Problem" return "FTP Error " + str(e) finally: print("status " + UploadOk) file_to_upload.close() ftp.close()I can see a FTP session is made , but the file won't uplaod O get this error: FTP Error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respondwhen I ty to upload to another device (the same file, same code) everything is working - so I know the code\file is OK the file is test.txt size 1 kb , there is more then 100MB free in the remote device what could be the reason for the error? why the file isn't been upload ? RE: Unable to upload file using FTP - ndc85430 - Dec-23-2021 Do you have access to the server? Can you check the logs for the FTP server running on there? RE: Unable to upload file using FTP - korenron - Dec-23-2021 it's a home router no so much logs all I can see it Dec/23/2021 14:29:35 user user logged in from 10.0.0.254 via ftp Dec/23/2021 14:29:57 user user logged out from 10.0.0.254 via ftpbut I have found the problem it seem that only Port 22 TCP is open , so the connection was made but a port to transer the data is block when I remove this rule - it works |