Skip to main content

How can I download file from ftpes:// to specified folder? I’m using the script below.

import fmeobjects
import os
from ftplib import FTP_TLS
import ssl

def processFeature(feature):
path = '/lsms/'
filename = 'apples.zip'

ftp = FTP_TLS('FTP-SERVER')
ftp.ssl_version = ssl.PROTOCOL_TLS
ftp.login('name', 'pass')
ftp.prot_p()
ftp.cwd(path)
ftp.retrbinary("RETR " + filename, open(filename, 'wb').write)
ftp.quit()
feature.setAttribute('name', filename)

 

Why not use the FTPCaller?


FTPCaller gives error with no clear info about it. I'm using older version of FME. Trying to work around this.


Hi @fikusas, what’s the error you’re running into when you try the FTPCaller? It might help to run your workspace with Log Debug enabled, sometimes that can give us a little more information as to what’s gone wrong. You can enable Log Debug by navigating to Tools > FME Options > Translation > Log Settings. 


Hi @fikusas, what’s the error you’re running into when you try the FTPCaller? It might help to run your workspace with Log Debug enabled, sometimes that can give us a little more information as to what’s gone wrong. You can enable Log Debug by navigating to Tools > FME Options > Translation > Log Settings. 

Log shows “Error” without any details about it. Probably its version bug.


Reply