Debugging Python Code

This is great!

FYI @Zach_Kron @Racel

Very nice @Gui_Talarico… Lots of Python features being worked on by customers :slight_smile:

We have been wanting to add this functionality to Core for a while…

@Gui_Talarico - Would you be interested in submitting this to Dynamo Core, and have you thought about doing a Designscript debugger?


Thanks @Racel !

Hi @Racel_Williams. Sorry I missed your second msg. I don’t really know C# well enough to be able to contribute to Core at this time, but anyone is more than welcome to borrow from this and create better implementations.

A few people asked me for clarification on how to use the Console, so I am adding more details below:

How to use RPW’s Console to debug python code:

1. Install RevitPythonWrapper (rpw) through the package manager

Note: Note that rpw package ships with a GettingStarted.dyn you can use to familiarize yourself with how it’s used withing Dynamo.

2. Build the graph below using RPW_GetFilePath and python node.

import sys
sys.path.append(IN[0]) # Assumes RPW_GetFilePath output is IN[0]

from rpw.ui.forms import Console

for i in range(10):
	if i ==5:


That’s awesome, thanks!


please advise

Please include the python code, and the output form the get file Path node. Are you on latest version? (1.3 I think!)

I’m having the same issue. Did I skip something?

import sys
sys.path.append(IN[0]) # Assumes RPW_GetFilePath output is IN[0]

from rpw.ui.forms import Console

for i in range(10):
   if i ==5:

I can’t reproduce this error here, so I will need someone who is having this problem to help us find the issue.

Here the source code of the GetFilePath node.
For some reason its not finding the file Path for the rpw library.

It assumes somewhere within ‘appdata/Dynamo’ it can find a folder called ‘RevitPythonWrapper’. The folder should be created when the package is installed:

import clr
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import os

appdata_path = os.getenv('appdata')
dynamo_path = os.path.join(appdata_path, 'Dynamo')

module_path = None
for root, subfolders, files in os.walk(dynamo_path):
	if 'RevitPythonWrapper' in subfolders:
		extra_path = os.path.join(root, 'RevitPythonWrapper', 'extra')
		module_path = os.path.join(extra_path, '')

I assume that’s only if you use the default Dynamo location? If i store my packages in a different location I’ll probably have to change the path, correct?

EDIT: Yup, that’s it! I moved the package to the default location and it worked fine.

1 Like

Awesome, thanks for helping track the cause.

Keep in mind the use of RPW_GetFilePath is optional and the node does not need to be used at all. It’s just mean to help.

For a custom install location, you can always just use something like:

import sys
rpw_path = r'C:\Users\XXX\AppData\Roaming\Dynamo\Dynamo Revit\1.3\packages\RevitPythonWrapper\extra\'
# Or any location where is stored.

import rpw

wt we should do now ?, can u show the graph :joy:

Hi @Gui_Talarico. I tried you debugger with the example described above and it works just fine, but I don’t know how to use it If I’m working with a python node which reads a script from a file (IDE is PyCharm) and it has 14 inputs?

Thanks in advance!

Hi @Jorge_Villarroel
Sorry I missed this msg!
Yes, you can use rpw’s console in pycharm just as you would with an embedded script:

import sys
rpw_path = r"C:\Users\gtalarico\AppData\Roaming\Dynamo\Dynamo Revit\1.2\packages\RevitPythonWrapper\extra\"
# Or any location where is stored. This one ^ was installed with the package manager
# but you can also download it form github
OUT = 'Test'
import rpw
from rpw.ui.forms import Console
for i in range(10):
    if i == 5:

You can read more about it here:


Just want to say this tools is enormously useful!!! Thank you @Gui_Talarico !!

1 Like

thanks for writing this, Gui, as well as your ironpython stubs which I’m using whenever I have Dynamo open.
As for this package - I assume Revit is necessary for this console to work? I’m using Dynamo for Alias, is there a possibility to use some other console or window for output like this?
Thanks in advance,


1 Like

Hi @Gui_Talarico, I use Revit 2020.2 & Dynamo 2.3 & RPW 1.7.2 and I get an error when I use the following code in the Python node for testing the RPW. Should it still work with Revit 2020.2 ? any help would be appreciated :slight_smile:

import sys
rpw_path = r’C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\’
import rpw
from rpw import revit
doc = revit.doc
OUT = doc

Error Message of the Python Node:

Warnung:IronPythonEvaluator.EvaluateIronPythonScript fehlgeschlagen.
Traceback (most recent call last):
File “”, line 17, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\”, line 36, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\”, line 19, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\db\”, line 10, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\db\”, line 35, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\”, line 1, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\ui\”, line 12, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\ui\forms\”, line 6, in
File “C:\Users\thomas.vogt\AppData\Roaming\Dynamo\Dynamo Revit\2.3\packages\RevitPythonWrapper\extra\\rpw\ui\forms\”, line 41, in
File “C:\Program Files\Autodesk\Revit 2020\AddIns\DynamoForRevit\IronPython.StdLib.2.7.8\”, line 11, in
ImportError: No module named _wpf


@Thomas3 Did you ever resolve this? I’m running into the same issue.

rps opens fine in Revit but i get the same error in dynamo as you have.

UPDATE: i got dynamo to be able to recognize rpw finally by just removing the underscore. you can find more about it here

Now i just need to get pycharm to be able to work with it.

my pycharm error is now this:

C:\Python27\python.exe C:/Users/username/PycharmProjects/pythonProject/
[WARNING] Error Importing CLR. Loading Mock Importer
Traceback (most recent call last):
File “C:/Users/username/PycharmProjects/pythonProject/”, line 13, in
File “C:\Users\username\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\\rpw\ui\forms\”, line 130, in init
AttributeError: ‘Console’ object has no attribute ‘PreviewKeyDown’

Process finished with exit code 1

and then in my dynamo, i’m getting this

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 14, in
File “C:\Users\username\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\\rpw\ui\forms\”, line 128, in init
AttributeError: ‘module’ object has no attribute ‘LoadComponent’