Hi all, all. To upload a file in an FTLS I used the FTP_TLS from ftplib, here is my code (I adapted from a code found on the web):
import ftplib from ftplib import FTP_TLS import os import ssl import sys server = XXXXXXXXXXXXX user = XXXXXXXXXXXXXXXX passwd = XXXXX PathFile = 'Q:\GW\EC1140WH_Con_HF\HCM_CARTS' def connect_ftp(): ftp = FTP_TLS(server, user, passwd) ftp.set_pasv(True) ftp.prot_p() ftp.set_debuglevel(2) return ftp def upload_file(ftp_connection, upload_file_path): try: upload_file1 = open(os.path.join(PathFile,upload_file_path), 'r') print('Uploading ' + upload_file_path + "...") ftp_connection.storbinary('STOR ' + upload_file_path, upload_file1) ftp_connection.quit() ftp_connection.close() upload_file.close() print('Upload finished.') except Exception, e: print("Error uploading file: " + str(e)) ftp_conn = connect_ftp() if ftp_conn: print("Success connection") upload_file(ftp_conn, 'LisezmoiReadme.docx')
Unfortunatly, I got the message:
*cmd* 'TYPE I' *put* 'TYPE I\r\n'
*get* '200 Type set to I.\r\n'
*resp* '200 Type set to I.'
*cmd* 'PASV' *put* 'PASV\r\n'
*get* '227 Entering Passive Mode (142,34,138,110,197,108).\r\n'
*resp* '227 Entering Passive Mode (142,34,138,110,197,108).'
*cmd* 'STOR LisezmoiReadme.docx'
*put* 'STOR LisezmoiReadme.docx\r\n'
*get* '125 Data connection already open; Transfer starting.\r\n'
*resp* '125 Data connection already open; Transfer starting.'
*get* '425 Data channel timed out due to not meeting the minimum bandwidth requirement.\r\n'
*resp* '425 Data channel timed out due to not meeting the minimum bandwidth requirement.'
Error uploading file: 425 Data channel timed out due to not meeting the minimum bandwidth requirement.
The last line is the error and i dont know how to resolve it? Any help please? Is it better to use the transfercmd command?
I use ArcGIS 10.1
Thanks a lot