Question

CSV reader with ftp path randomly fails

  • 1 October 2015
  • 8 replies
  • 3 views

Hello all,

 

 

I have a problem with CSV reader with FTP path in FME Desktop / FME server 2015.1.

 

 

My goal is to watch an FTP server for new files, when a new file comes in, test the name for today’s date and the extension for .csv, do some manipulation to that file and put the data in a database. Once it is done, I want to trigger a job on the database.

 

 

As for now, I have a watcher on my FTP server which triggers a workbench that tests the name of the file and launch another workbench with an fmeServer_JobSubmitter. This workbench has a csv reader that takes the FTP path of the file and reads the file. It does the manipulations and put the result in the database. Then, the original workbench triggers the job on the database.

 

I have around 150 files to load every morning and it works for around 140-145 of them every time, but there are a few files that don’t work for a mysterious reason.

 

 

For the files that didn’t work, I tried the use the same JSON received by the watcher in the “test topic” section and it works. I compared the log files of the job that I ran with the “test topic” and the one that failed initially and in the job that works, I see this info:

 

CSV Reader: Opening CSV files in folder `C:\\Windows\\TEMP\\fmeengines\\VL-MH-GIS102_Engine1\\__swizzled_url_1443705296930_21796/\\'

 

But in the job that fails, I see the following warning instead:

 

CSV Reader: Failed to read the specified file(s) in the folder 'ftp://<user>:<password>@<IP>/%2F<relative path> /<filename>\\'

 

 

Do you have any idea what could cause my problem? Or do you have any suggestions on how I could achieve my goal differently?

 

 

Thank you very much for your time!

8 replies

Userlevel 4
Hi

 

 

Could it be that you have a "%2F" too much in your ftp path? The value "%2F" is an encoded forward slash and it might be what's causing the error.

 

 

David
Hi David,

 

 

 

Thank you for your quick reply!

 

Unfortunately, I need this %2F because it is an absolute path. I wrote relative path by mistake I'm really sorry about that!

 

Moreover, all my files are in the same directory and it works with that path for most of them.

 

 

 

Thanks again!
Userlevel 4
Are you sure that the encoded version of the forward slash "%2F" is supported by your ftp client?

 

 

Does it work for any of the other files?

 

 
Userlevel 4
Also, what happens if you copy/paste the failing path into e.g. Internet Explorer? Does that work?

 

 
Yes it works with all the other files and when I copy paste in IE, I can download the file.

 

However, there is a \\ at the very end of the path filename in the warning message and it doesn't work if I copy it. Maybe it is the cause of the problem, but then I don't understand why there is a \\ because it is not in the path sent to the workbench throught the fme server job submitter...

 

Thank you so much for your help David, it is really appreciated!
Userlevel 4
If you have a backslash at the end of the file name, that could well be the problem.

 

 

You could perhaps try to get rid of it using a StringReplacer, like this:

 

 

 

 

David
It’s a good idea, but I don’t know if it feasible because the master workbench sends the correct path to the second workbench which uses it directly in the reader that mysteriously adds the backslash.

 

I will try some things to remove that backslash and let you know. I might not have any answer until tomorrow though because it randomly fails so I can’t really test it. 
I managed to write the filename I send to my second workbench and it does not contain any backslash at the end. So maybe it is the reader in my second workbench that adds it, but I don't know what I can do about that. 

 

Also, looking back at the log, I see in the job that succeeds that there is a backslash at the end of the path, so maybe it is FME that needs that backslash for some reason. And when the job works, it seems to be downloading the csv file to a temp directory before reading it, which is not done when it fails.

Reply