Any of the Codes is running :( | Basics for copy/paste codes

Hello Dynos,

I know it is basic question… but what do I wrong? is there a basic frame? or a missing library additional to the Code?

It doesn`t find libaries? some blockes are not defined?

How use I a code in a correct way: ?


You should paste your code here so we can see it ,or at least provide a screenshot of your python code.


TESTED REVIT API: 2016,2017,2018

Author: min.naung@ |

This file is shared on
For more information visit
from Autodesk.Revit.DB import FilteredWorksetCollector, WorksetKind

document instance

doc = revit.ActiveUIDocument.Document

collect user created worksets

worksets = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset).ToWorksets()

loop worksets

for workset in worksets:
# print name, workset
print workset.Name,workset

The errors came from the underlined libraries I use dynamo 0.9 … Revit 2016

Hi @Draxl_Andreas,

The code above is likely created for Revit Python Shell, and not Dynamo. The code itself will work in a python node, but the imports needs to be tweaked.

Search this forum for any posts that includes the imports in a python node. Place the imports in the code you’ve posted and remove everything before the “#collect user created worksets” line.

Good luck :slightly_smiling_face:

1 Like

Thank you very much! I am Architect and i am not a native-speaker regarding Revit-Python-Dynamo - so your answer is a good answear!

If you aren’t speaking Revit python dynamo: I’d suggest you start with dynamo and some useful packages.

Clockwork has a node that returns all the Worksets
GeniusLoci has a similar node too.

1 Like

…so I almost done look:

I am able to list the worksets but not with the name! So how should be the chances in my script

The script Dynamo primier helped me a lot!

Thank you



…you have right! but i want to understand, i would like also do costumize stuff - I try to learn first and not just doing stuff- In spite of that thank you very much for the packages!

As you wish, but do remember that you inspect custom nodes.


Your final loop looks strange: Try this.

wsnames = []
for workset in worksets:

OUT = wsnames
1 Like


I’m glad you now have a script that works.
To clarify what @3Pinter has written, there are many possibilities with existing packages.

1 Like