Clean up CSV from unwonted chars

I am trying to log the output of a script using the csv node and the edit write file node.
The script outputs a series of formatted string:

 tnow=('{0:%H:%M:%S.%f}'.format(datetime.now()))
         a=  "  {:.5f}   {:.3f}    {:.5f}    {:.3f}    {:.5f}    {:.5f}    {:.1f}    ".format(A,B,C,D,E,F,G)
         print(tnow+a)

13:45:40.510468 26.91675 3.294 0.68604 18.466 0.00000 0.00000 0.0

But the csv file is written with additional chars which I don't know from where they come:

{"13:45:40.510468 26.91675 3.294 0.68604 18.466 0.00000 0.00000 0.0":""}

And the output of the debug node shows:
Schermata 2022-01-25 alle 13.54.56

I don't understand from where the additional chars are coming. Any suggestion on how I can have a clean csv with the same output of the script without all those addition chars?

[{"id":"c4ff59a7c876123f","type":"exec","z":"c77ba1683e345234","command":"python -u /home/pi/Develop/Learning/alpha.py","addpay":"","append":"","useSpawn":"true","timer":"","winHide":false,"oldrc":false,"name":"Exec","x":450,"y":160,"wires":[["95e286e610094ef3","0837a20b3c2e560d"],[],[]]},{"id":"d8009e14444903ed","type":"file","z":"c77ba1683e345234","name":"","filename":"/home/pi/Develop/Learning/alpha_py_output.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":640,"y":280,"wires":[["e2bc0a61f5694f00"]]},{"id":"e2bc0a61f5694f00","type":"debug","z":"c77ba1683e345234","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":280,"wires":[]},{"id":"0837a20b3c2e560d","type":"csv","z":"c77ba1683e345234","name":"","sep":"\\t","hdrin":false,"hdrout":"once","multi":"one","ret":"\\n","temp":"BatVoltage,P1,CurrentA,Pinst,meanVoltage,meanCurrent,getOcV(meanVoltage),c","skip":"0","strings":true,"include_empty_strings":true,"include_null_values":false,"x":610,"y":180,"wires":[["d617f992a8217944","d8009e14444903ed"]]},{"id":"95e286e610094ef3","type":"debug","z":"c77ba1683e345234","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":120,"wires":[]},{"id":"d617f992a8217944","type":"debug","z":"c77ba1683e345234","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":800,"y":180,"wires":[]}]

Not sure you need the CSV node here - it will be trying to convert the input string into a javascript object with properties. So you probably don't really need it - and just change your source to include commas, in the right places...

You are a star!
Thanks a million. Sometimes less it is better.

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