Python/FTPlib - return results of FTP transfer? -
i have function transfers file ftp server, possible store result of session?
code below:
.... tempfile.namedtemporaryfile() temp: temp.write(content) temp.seek(0) filename = temp.name session = ftplib.ftp('10.66.118.251','build','password') session.storbinary('stor {0}'.format(file_name), temp) session.quit() temp.flush()
i have tried below results:
... tempfile.namedtemporaryfile() temp: ... temp.write(content) ... temp.seek(0) ... filename = temp.name ... session = ftplib.ftp('10.66.118.251','build','password') ... session.storbinary('stor {0}'.format(file_name), temp) ... session.quit() ... temp.flush() ... '226 transfer complete.' '221 goodbye.' >>> print session <ftplib.ftp instance @ 0x3018098> >>> print session.storbinary() traceback (most recent call last): file "<console>", line 1, in <module> typeerror: storbinary() takes @ least 3 arguments (1 given) >>>
Comments
Post a Comment