# Return Current Dynamo Workspace's Warnings

**URL:** <https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135>\
**Category:** Developers\
**Created:** [May 3, 2022, 9:43pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135 "2022-05-03T21:43:39Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsayle](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wsayle/32/125475_2.png) [@wsayle](https://forum.dynamobim.com/u/wsayle)\
**Post date:** [May 3, 2022, 9:43pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/1 "2022-05-03T21:43:39Z")

</div>

Hello,

I was trying to reference [this post’s solution](https://forum.dynamobim.com/t/get-the-name-of-a-node/68019/3) and I want to add a little to it. I want to return all of the nodes as they do and then somehow access if the given node is returning a warning. I can then return this as an output to the user in some form later. Trying very hard to find documentation on the Dynamo API…but to no avail.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/9/89a0191e7191b050ad2e63da28087643035bc9d9.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 4, 2022, 7:26am UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/2 "2022-05-04T07:26:14Z")

</div>

Thats a great topic!

I look for Dynamo API stuff… i cant realy find. i would like do costumnodes…

```auto
# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
clr.AddReference('DynamoRevitDS')
import Dynamo

# Die Eingaben für diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace

nodeNames = [[],[]]

for i in currentWorkspace.Nodes:
	nodeNames[0].append(i.Name)
	
for j in currentWorkspace.Nodes:
	nodeNames[1].append(j.Warning)

OUT = nodeNames

```

_Can you see also packageNames ?_

KR

Andreas

 ![2022-05-04_09h29_01](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/7/c756551c655d0ccbc5e5510579ebdd45b23ade1c.png)

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [May 4, 2022, 10:36am UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/3 "2022-05-04T10:36:37Z")

</div>

Hello  
here an example

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/f/dfafe7757e9a20a69055bda4b02beb4d1ac27908.png)

```auto
import clr
import sys
import System
from System.IO import Directory, File
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('DynamoCoreWpf') 
clr.AddReference('DynamoCore')
clr.AddReference('DynamoRevitDS')
import Dynamo 
from Dynamo.Applications.ViewModel import *
from Dynamo.Graph.Workspaces import *
from Dynamo.Models import *
from Dynamo.ViewModels import *
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace

out = []
for i in currentWorkspace.Nodes:
	if "Warning" in i.State.ToString():
		out.append([i.Name, i.ToolTipText])
		
OUT = out

```

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [May 4, 2022, 10:49am UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/4 "2022-05-04T10:49:32Z")

</div>

Hello,

Where is this resource of this information? or just powerfull mind? 🙂  
f.e. where are these libraries? is there a list?

KR

Andreas

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [May 4, 2022, 11:16am UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/5 "2022-05-04T11:16:44Z")

</div>

Hi @Draxl_Andreas

> [@Draxl\_Andreas](#):
>
> Where is this resource of this information? or just powerfull mind? 🙂  
> f.e. where are these libraries? is there a list?

this topic may be help you

> [@Accessing DynamoCore and DynamoRevit Assemblies and Namespaces in Python](https://forum.dynamobim.com/t/accessing-dynamocore-and-dynamorevit-assemblies-and-namespaces-in-python/75462):
>
> @solamour Last question: Why do I need the “DynamoRevitDS” ? I am not using anything of this library. It seems that I’m not getting the AddReference and import stuff right. For me it was always like this: If I want to use e.g a dynamo core node inside of a python script I did the following: I want to use List.Flatten so I look for it in github and find it in the “CoreNodes” library. From the Properties folder I search for the Assembly file and inside of it for the assembly title which is “DSC…

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [May 4, 2022, 11:26am UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/6 "2022-05-04T11:26:02Z")

</div>

You will really need to watch the order that things are executed, because you may want this python node to have every possible avenue of nodes connecting into it.

This will mean that it will not run until after everything else has been run.

Also the following may help you: [DynamoVisualProgramming.Core 2.14.0.4641 - FuGet Gallery](https://www.fuget.org/packages/DynamoVisualProgramming.Core/)

---

<div class="post-metadata">

**Author:** ![wsayle](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wsayle/32/125475_2.png) [@wsayle](https://forum.dynamobim.com/u/wsayle)\
**Post date:** [May 4, 2022, 1:50pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/7 "2022-05-04T13:50:58Z")

</div>

I’m inclined to mark this as a solution as it returns Exactly what I need! However, it only works under certain circumstances. I think what is happening is that the entire program needs to run for it to return warnings. And so a lot of times the py script returns a null list even though there are warnings because (what I believe) the program has not yet entirely finished so there are no warnings to return. I have to make a small change to script (like adding a node for example) for the script to run completely again and it will show an output correctly.

Not sure if this all makes sense, but as of now cant get it to return warnings consistently. The ultimate goal being to see a watch node output of the warnings in the dynamo player. Even running in the player 2x in a row doesn’t return anything other than null

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/f/0fbbc6255c1c78ee7d5a5113c19a5d6becad946c.png)

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [May 4, 2022, 4:37pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/8 "2022-05-04T16:37:48Z")

</div>

> [@wsayle](#):
>
> And so a lot of times the py script returns a null list even though there are warnings because (what I believe) the program has not yet entirely finished so there are no warnings to return

I think the only solution will be to run the script via a different context (via RevitDynamoModel class) from an addin or a macro  
some examples

> [@Execute Dynamo Script from Revit API](https://forum.dynamobim.com/t/execute-dynamo-script-from-revit-api/60529):
>
> Hi, I have a Revit Add-In with many commands. As part of he Add-In I am trying to allow users the ability to specify their own Dynamo scripts to be run at different points within a “long running” command. I have successfully got this setup but have run into a problem. With the way I have it implemented, the user specified Dynamo Script(s) continue to execute after my “long running” command has ended each time a change is made to the Revit project. Below is snapshot of code I am using to execut…

> **[\[Dynamo += Python\] Lancer des Scripts hors Dynamo](https://voltadynabim.blogspot.com/2021/09/dynamo-python-lancer-un-script-hors.html)**
>
> Blog sur le BIM, du Python et d'la Dynamo appliqués aux électrons

---

<div class="post-metadata">

**Author:** ![wsayle](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wsayle/32/125475_2.png) [@wsayle](https://forum.dynamobim.com/u/wsayle)\
**Post date:** [May 4, 2022, 6:28pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/9 "2022-05-04T18:28:34Z")

</div>

Thank you! You’ve given me a lot to work with.

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [May 4, 2022, 8:16pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/10 "2022-05-04T20:16:26Z")

</div>

@wsayle as @Brendan_Cassidy suggested, you’ll want to **force your Python node to execute last**. Given that Dynamo gets pretty smart about how to retain output from nodes that have already processed, but not changed, and the subsequent way it bundles up the nodes into a “action sequence” to be run through the Virtual Machine, you’ll need the ensure that the Python node comes last - every time.

Easiest way to do this is connect it into the last node in your graph’s chain of nodes - with a dummy input port.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/5/e5d3292c65f90c193192456f1e04450506f33451.png)

If you want to work with this node in a live graph, not just with Dynamo Player, you’ll also need to force the Python node to re-execute 🙂 To do this, you can have a second dummy input of “DateTime.Now” that is an always-updating node, which then always puts new data into the Python node to force it to reexecute and get around the “Smarts” of delta-compute.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/62065725de9bad212e0c95d657327bafba60940b.png)

And as a final aside, we are looking into ways to get this information to you inside of Player right now 🙂 CC @LilliSmith @nate.peters @craig.long

---

<div class="post-metadata">

**Author:** ![wsayle](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wsayle/32/125475_2.png) [@wsayle](https://forum.dynamobim.com/u/wsayle)\
**Post date:** [May 4, 2022, 8:58pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/11 "2022-05-04T20:58:18Z")

</div>

@solamour thank you for the detailed response! I appreciate you going into some of that detail. Several dynamo users I have spoken to are looking forward to the added features.

I tried what you said and still getting the same issue unfortunately ☹ The python script is at the end with the DateTime.Now input. However when I run the program again (no delta change) the date and time does not change within the editor. The player doesn’t change the py script update either when ran 2x in a row.

I’m using Revit 2022 and the dynamo version is the following. (could never get it to update for some odd reason)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/1/21cdd1ea614d3a82df95ecdc2da4db718837711a.png)

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [May 4, 2022, 9:12pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/12 "2022-05-04T21:12:55Z")

</div>

> [@wsayle](#):
>
> I’m using Revit 2022 and the dynamo version is the following. (could never get it to update for some odd reason)

The version shouldn’t matter here - as this workflow hasn’t changed… I wonder why yours isn’t working then 🤔

Is the output of your `DateTime.Now` node changing when you run the graph?

What does your Python look like - identical to mine? Is it saying any syntax errors?

---

<div class="post-metadata">

**Author:** ![wsayle](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wsayle/32/125475_2.png) [@wsayle](https://forum.dynamobim.com/u/wsayle)\
**Post date:** [May 4, 2022, 10:00pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/13 "2022-05-04T22:00:43Z")

</div>

Code looks the same I believe!

```auto
*
import clr
import sys
import System
from System.IO import Directory, File
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('DynamoCoreWpf') 
clr.AddReference('DynamoCore')
clr.AddReference('DynamoRevitDS')
import Dynamo 
from Dynamo.Applications.ViewModel import *
from Dynamo.Graph.Workspaces import *
from Dynamo.Models import *
from Dynamo.ViewModels import *
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace

dummyInput = IN[0]
forceRexecute = IN[1]

out = []
for i in currentWorkspace.Nodes:
	if "Warning" in i.State.ToString():
		out.append([i.Name, i.ToolTipText])
		
OUT = out
*

```

Run 1

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/f/afdff8c62446d0284bff844efe35e01fa80f43ef.png)

It’s almost like it doesn’t trigger that delta-compute at all…

Run 2

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/0/90dd70e4fd3350fb2f86bdc847b8be1a8a014715.png)

Dynamo Player. A little different - but still no output without editing the script itself and running again.  
Run 1  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/7/c7e991806ede5b6988fe78b1f9fa280f5fceadea.png)

Run 2  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/2/72e7e34cd3c5686c21ac765970fab3c482c1f190.png)

---

<div class="post-metadata">

**Author:** ![solamour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/solamour/32/153516_2.png) [@solamour](https://forum.dynamobim.com/u/solamour)\
**Post date:** [May 5, 2022, 2:09pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/14 "2022-05-05T14:09:25Z")

</div>

Delta-compute is essentially when Dynamo chooses to run, or not run certain nodes depending on if they would return a different result 🙂

My apologies, I was mistaken. DateTime.Now will update every time you run it, as it queries the system clock, in `Periodic` mode (Which is also why it will run in Player as the process is similar - essentially start graph from scratch), but not in `Manual` in Dynamo 2.14.

In order to force your Python node to update, you need to have something change coming into that node. If you try do this with by clicking “+” on the Python node, then running, then clicking “-” again does it work correctly? That is forcing a `change` in the node.

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [May 5, 2022, 3:39pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/15 "2022-05-05T15:39:49Z")

</div>

To force the datetime node to re-run you can use the following python code here ([Force Run Python - Revit - Dynamo (dynamobim.com)](https://forum.dynamobim.com/t/force-run-python/31709/2)).

Make sure you add this as a new python node!

If you rename any node(eg your original python node) with “\*Force” without the quotes of course, it will force that node to be re-run everytime. Though i would always keep the inputs you currently have within it, so it is keeps your original python node running last.

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [May 5, 2022, 7:01pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/16 "2022-05-05T19:01:44Z")

</div>

A workaround, just for the fun 🙃  
playing with Dynamo API Event (EvaluationCompleted)  
 ![get_Nodes_errors](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/c/8cc836e964be26535f973fff2944102a877862f9.gif)

Python code

```auto
import clr
import re
import time
import sys
import System
from System import EventHandler, Uri

clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
import System.Drawing
import System.Windows.Forms

from System.Drawing import *
from System.Windows.Forms import *
from System.Collections.Generic import List

clr.AddReference('DynamoCoreWpf') 
clr.AddReference('DynamoCore')
clr.AddReference('DynamoRevitDS')
clr.AddReference('DynamoServices')
import Dynamo 
from Dynamo.Graph.Workspaces import *
from Dynamo.Graph.Nodes import *
from Dynamo.Models import *
	
# access to the current Dynamo instance and workspace
dynamoRevit = Dynamo.Applications.DynamoRevit()

class FormInfo(Form):
	def __init__ (self, dynamoRevit):
		self._dynamoRevit = dynamoRevit
		self._model = dynamoRevit.RevitDynamoModel
		self._currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace
		self._currentWorkspaceNode = [x.Name for x in self._currentWorkspace.Nodes]
		self.InitializeComponent()
	
	def InitializeComponent(self):
		self._label1 = System.Windows.Forms.Label()
		self._buttonCancel = System.Windows.Forms.Button()
		self._richTextBox1 = System.Windows.Forms.RichTextBox()
		self.SuspendLayout()
		self._dynamoRevit.RevitDynamoModel.EvaluationCompleted += EventHandler[EvaluationCompletedEventArgs](self.EventResumeNodes)
		# 
		# label1
		self._label1.Location = System.Drawing.Point(30, 9)
		self._label1.Name = "label1"
		self._label1.Size = System.Drawing.Size(152, 25)
		self._label1.TabIndex = 0
		self._label1.Text = "List Errors"
		# 
		# buttonCancel
		self._buttonCancel.Location = System.Drawing.Point(150, 550)
		self._buttonCancel.Name = "buttonStop"
		self._buttonCancel.Size = System.Drawing.Size(156, 37)
		self._buttonCancel.TabIndex = 0
		self._buttonCancel.Text = "Quit"
		self._buttonCancel.UseVisualStyleBackColor = True
		self._buttonCancel.Click += self.ButtonCancelClick
		# 
		# richTextBox1
		self._richTextBox1.Location = System.Drawing.Point(30, 37)
		self._richTextBox1.Name = "richTextBox1"
		self._richTextBox1.Size = System.Drawing.Size(400, 500)
		self._richTextBox1.TabIndex = 1
		self._richTextBox1.Text = "NO ERRORS"
		# 
		# FormInfo
		# 
		self.ClientSize = System.Drawing.Size(480, 600)
		self.Controls.Add(self._label1)
		self.Controls.Add(self._richTextBox1)
		self.Controls.Add(self._buttonCancel)
		self.Name = "FormInfo"
		self.Text = "FormInfo"
		self.ResumeLayout(False)
		
	def EventResumeNodes(self, sender, e):
		try:
			self.ResumeNodes()
		except Exception as ex:
			self._richTextBox1.Text = 'ERROR TRACEBACK' + str(ex)
		
	def ResumeNodes(self): 
		lstError = []
		if self.Controls.Count > 0 and all(not x.IsDisposed for x in self.Controls):
			for i in self._currentWorkspace.Nodes:
				if i.State == ElementState.Warning:
					lstError.append("###############################")
					lstError.append("Node : {}".format(i.Name))
					lstError.append("Error : {}".format(i.ToolTipText))
					lstError.append("###############################")
			self._richTextBox1.Text = "\n".join(lstError)

	def ButtonCancelClick(self, sender, e):
		self._model.EvaluationCompleted -= EventHandler[EvaluationCompletedEventArgs](self.EventResumeNodes)
		self.Close()
		self.Dispose()

objInfo = FormInfo(dynamoRevit)
objInfo.Show()
OUT = 0

```

[scriptError\_v3.dyn](https://forum.dynamobim.com/uploads/short-url/aKtWznKW0yx13Dd9izuMRyLyk2r.dyn) (17.6 KB)

---

<div class="post-metadata">

**Author:** ![wsayle](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/wsayle/32/125475_2.png) [@wsayle](https://forum.dynamobim.com/u/wsayle)\
**Post date:** [May 5, 2022, 8:07pm UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/17 "2022-05-05T20:07:59Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7fe2a19209daa531de48029e408d7e27886fc2ed.png)  
Still not working! 😒

In other news, I did do the api workaround with a macro that does return the errors. Wish I could get it within player. But I think from now on this thread can be more academic. I really appreciate all of the help! Very informative. 🙂

---

<div class="post-metadata">

**Author:** ![Brendan\_Cassidy](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/brendan_cassidy/32/7685_2.png) [@Brendan\_Cassidy](https://forum.dynamobim.com/u/Brendan_Cassidy)\
**Post date:** [May 6, 2022, 8:42am UTC](https://forum.dynamobim.com/t/return-current-dynamo-workspaces-warnings/76135/18 "2022-05-06T08:42:07Z")

</div>

Could you provide your script on where you have it up to and I might be able to sort something 🙂
