CSW writer, avoid tailing line break

Hello there,
Does anyone know how to deal with last empty line in CSV writer?
I found this thread, but it cuts on “use DB Loader”. In case of this fellow it might work, but I’m uploading the file to FTP to Adobe Analytics. Unfortunately, they do not support other easy upload ways.
How can I get rid of this tailing row escape?

Thanks in advance

Hi @kalinichenko , you can give this component a go if you cannot find an alternative solution.

Have the csv writer create a path variable for the output file location

Attach the component to the CSV Writer. You may need to execute the component once so that it can “see” the path variable.

Choose what you want it to remove, and execute. This is new, so please be sure to test it works correctly before you use it on important files!

1 Like

Eh, sorry, but not working as expected

Hi @kalinichenko, Can you tell me which options you have chosen on the config, and what it is/isn’t doing as a result?

I cannot see from your screenshot whether it ends in a CR/LF

I’ve chosen exactly these options

CSV writer settings are following

Thanks for spending time with my problem

Thanks for the additional info @kalinichenko . I made a schoolboy error and hadn’t spotted it was only removing one character each time it was called. On Windows it uses CR and LF together so it would have worked if it was called twice! :wink:

This is hopefully fixed, so if you right click the component and update it, you should get the latest version. Let me know if that resolves it.

1 Like

I’m sorry for a delay. I updated the component, but now I receive an error:

Inside the component it looks following:

Hi @kalinichenko , what type of file path are you writing to? Is it a local folder, or somewhere else?

For the QA I was writing to local disk.

Very strange. I don’t know why it wouldn’t be working for you, especially as it didn’t error on the previous version. Nothing changed with respect to that internal component.

For me it works fine working with local files, and I haven’t been able to make it produce that error. I’ve updated it again on the hub, removing the internal component and replacing it with the regular Path to String (variable).

Try updating the component again.

Hi Brian,

I’m sorry, I’m still learning KNIME and definitely I far from Java, so something simple might slip from me. I don’t know why it is not working. Please see screenshot of errors and set up

This is testing sub flow where .csv writes to local disk

I connected the .csv writer with the component in a following way

Inside the component I face following:

Some thing I’m concerned about:

  • the .txt file is closed, so it is not like the file is blocked
  • might it be because of file format? .txt?

No need to apologise @kalinichenko , in the words of Taylor Swift … I’m the problem… it’s me! :wink:

(file “.txt” name and locking aren’t the problem)

This is going to sound repetitive, but please try updating the component again. It appears that in my haste to fix it previously, I forgot an important step in renaming the flow variable that the java snippet was expecting, which is the error in the latest screenshot you posted.

Hopefully it will now work for you, and I haven’t introduced any further bugs :slight_smile:

Here are the results in a test .csv file I created, viewed using HxD Hex Editor


test file eof removal.knwf (38.2 KB)

Before running component:

After running component:


Hello again,

I would say it works 99% :smiley:

First it failed, but I found where,
This nodes expects exactly this value

So when in CSV writer I set up something friendly to my workflow - it failed. Then, when I used briwozere - it worked.

Would it be possible to unlock the value?

Hi @kalinichenko , glad it works, but it isn’t expecting “briwozere”. That is simply the “ghost” of a value I tried just to prove it didn’t need a specific value. Components sometimes unfortunately “hang on” to some config values when they are shared.

Because this component is having to analyze the path variables available to it, it needs to be execute once before it can be correctly configured, but once you have done that and configured it “briwozere” should be no more :wink:

The only place “briwozere” appears as a variable name is in the config of the CSV Writer. It is not hard-coded or “locked” anywhere by the component:

So the variable can be changed in the config for the CSV Writer, but until the component is re-executed once, it will not know about the new name:

So configure the CSV Writer, and then execute the component once. It will fail with the red error icon (white cross on red circle)

Configure the component and everything will be resolved.

btw, this is all because there is no “path variable configuration” available to components. I have had to build a drop down that is populated by path variables, and for that to work, the component has to have this additional “pre-execution” step before it can be configured.

1 Like

Thanks for detailed explanation!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.