hasanatkazmi wrote:in "put", you logged off and then logged in again, why? this looks like a work around for a potential bug
In your python script make sure you reuse your initial connection.
handle.storbinary("STOR " + filename,f,1024)
def putfile(file=file, site=site, dir=dir, user=())
upFile = open(file, 'rb') # upFile file of same name
handle = ftplib.FTP(site) # connect to ftp site
apply(handle.login, user) # anonymous or real login
print "Upload started"
handle.storbinary('STOR ' + file, upFile, 1024)
print "Upload completed"