Ok, so ... I have a python program that needs to upload a file to a FTP , but somehow I keep getting a
TimeoutError: [Errno 60] Operation timed out
I'm a beginner so most likely I'm doing something wrong,but after some trail and errors I'm still stuck. Also, when I have to introduce a regex to search for a file which constantly changes its name, python interprets the regex as a string and not as code. Why does that happen? Please excuse my ignorance...
import ftplib
import bz2
filename = "cv(\d+)"
ftp = ftplib.FTP("host", port, timeout)
ftplib.FTP.connect("host","user","pass", port, timeout)
ftp.write(bz2.compress("pass"))
ftp.prot_p() # switch to secure data connection
ftp.storeline('STOR'+filename)
ftp.quit()