I want to export a list to csv but i want it to be a new line in the file.
It works if I send a single string but list cause an error.
I’m not great with python so I have hacked together a few scripts I found.
>
import clr
import os
import datetime
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference('DynamoRevitDS')
import Dynamo
# Current doc and title
doc = DocumentManager.Instance.CurrentDBDocument
docTitle = doc.Title
# Check Dynamo workspace properties
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace
script = currentWorkspace.Name
# Get properties for writing the log file
dateStamp = datetime.datetime.today().strftime("%m/%d/%y")
userName = os.environ.get('USERNAME')
userProfile = os.environ.get('USERPROFILE')
# Set Inputs
filepath = IN[0]
input = dateStamp + "," + docTitle + ".rvt" + "," + userName + "," +IN[1]
with open(filepath, 'a') as file:
file.writelines(input + "\n")
result = True
OUT = "success"