K
K
Kiri4ok2019-09-01 15:27:10
Python
Kiri4ok, 2019-09-01 15:27:10

Trouble uploading data to FTP Python?

Upload files to FTP with this script

import ftplib
 
host = "XXXX"
ftp_user = "XXXX"
ftp_password = "XXXX"
filename = "txt.txt"
FTP_TIMEOUT = 10
 
con = ftplib.FTP(host, ftp_user, ftp_password, FTP_TIMEOUT)

con.set_pasv("true")
f = open(filename, "rb")
con.cwd('htdocs')

con.storbinary("STOR "+ filename, f)

con.close()

On the line con.storbinary("STOR "+ filename, f) the script hangs without error, I found only such a download method on the Internet

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-09-01
@dimonchik2013

rights to where you store
file size
log
passive ftp
other libs ( ftputil )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question