I am trying to export some formatted message from python node to a text file.
But I am not getting the output because of some error. I have pasted the screenshot of the code and the error in node.
Please help.!
Screenshot%20(6)|690x388
I am trying to export some formatted message from python node to a text file.
But I am not getting the output because of some error. I have pasted the screenshot of the code and the error in node.
Please help.!
Screenshot%20(6)|690x388
While simply writing to a file e.g. ‘text.txt’ is valid for a normal python script, you need to provide the full path for writing in dynamo.
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import os
filedir = r'C:\test'
filename = 'text.txt'
filepath = os.path.join(filedir, filename)
message = 'example message’
with open(filepath, 'w') as f:
f.write(message)