Hi Everyone,
I want to write my list to a .txt file - but it error both with the build in node “WriteText” an this python script. any suggestion?
Revit version: 2021
Dynamo build: 2.6.1
Hi Everyone,
I want to write my list to a .txt file - but it error both with the build in node “WriteText” an this python script. any suggestion?
Revit version: 2021
Dynamo build: 2.6.1
Hi @nbpe0509 ,
Have you tried transforming the list data into strings?
Also if you look at the error message you can see why it fails, what ascii symbol is on that line?
Put watch Node and copy to clipboard.
You don’t likely want to write a list of strings to a text file, but a single string where each item in the list is on a new line.
Try adding a String.Join node to clean that up.
The out of the box node should work after that.
I like to use this node (a special watch node) by @Dimitar_Venkov springs package
Hej @MartinSpence
ExportCSV kan ikke lide “æ,ø,å”
Hi @Daan so fare i find out that a special symbol has ben used “≥” and that’s way it fails
Hello
try this
# coding: utf-8
import sys
import codecs
# to write
with open(IN[0], "w") as f:
f.writelines(x.encode('utf-8') + "\n" for x in IN[1])
# to read
with codecs.open(IN[0], "r", encoding="utf-8") as f:
txt = f.read()
OUT = txt
Hi @c.poupin and @MartinSpence
It seems like your scripts are working but when I read the .txt file in Revit (Keynote settings) it will change some of the letters.
from txt file
423.001 AKUSTIKBEKLÆDNING 1. LYS (TØ)
from revit
The selected font might not permit those special unicode characters. Best to confirm you can type them manually.
I think I found some of the problem now.
The Unicode format “utf-8” doesn’t support “æ,ø,å”.
Any suggestions on how to “translate” or have an other format that support both “æ,ø,å” and “≥”?
Hi @Kulkul
Unfortunately same issue - when I load it into Revit (by keynote setting) it translates the “æ,ø,å” and “≥” to some wrong letters
Can you manually create those characters in the Revit UI?
That doesn’t match with the current topic. If you can’t write those character in Revit UI then request this on Revit Forum.
Good Luck!
Regarding this post, same issue with æ, ø, å, but I need to write to a csv file. Its a huge list, any suggestions?
Thanks!
Hej Anders…yes it isnt easy…you can offcourse replace illegal’s characters…but then it doesnt give you ÆØÅ…the way i have done it before was in csv file…with find and replace…looking forward to what you come up with…
@sovitek, yes, have done this also, and its an easy fix too, but still… : )