PyRevit CSV export IronPython.Runtime.List issue

PyRevit CSV export IronPython.Runtime.List issue

Papopoprostupapo
Explorer Explorer
498 Views
2 Replies
Message 1 of 3

PyRevit CSV export IronPython.Runtime.List issue

Papopoprostupapo
Explorer
Explorer

Hello,
I am developing a pushbutton tool for PyRevit that will automatically gather readable data on project`s walltypes, their materials and their widths into a CSV file.

I managed to print out the data as lists of strings and lists of lists of strings. Then at the end I write the data to a csv file, but the strings return as IronPython.Runtime.List in the file, even though they appear as string inside pyrevit.

Papopoprostupapo_0-1666713170981.png

I`ve tried to run the code through python3 by adding #!python3 at the first line, but that just breaks the __get__(i) part.

How do I get these strings into csv?

 

 

My code:

Papopoprostupapo_1-1666713442007.png

Papopoprostupapo_2-1666713504552.png

 

 

 

Accepted solutions (1)
499 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

This is a pure Python question and has nothing to do with the Revit API, so this is not the optimal place to ask. I suggest you search the Internet for something like "python list to csv":

  

https://duckduckgo.com/?q=python+list+to+csv+string

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 3

Papopoprostupapo
Explorer
Explorer
Accepted solution

In case anyone is interested I did as @jeremy_tammik suggested and found an answer:

The IronPython.Runtime.List object has to be iterated over in order to write rows.


The last bit of code:

Papopoprostupapo_0-1666722953389.png

 

0 Likes