Cflux
Cflux

Reputation: 1532

Revit Dynamo RevitPythonShell - Python Debugger - ImportError: No module named _wpf

I'm trying to get the Revit python shell debugger working in my dynamo but I'm running into issues. It seems to run in Revit alright but I cant get the debugger in dynamo to work as shown here.

Also if anyone has any other methods for debugging python code in Revit, feel free to let me know!

Here is the error I'm getting:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line 13, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\__init__.py", line 36, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\db\__init__.py", line 19, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\db\view.py", line 10, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\db\collector.py", line 35, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\__init__.py", line 1, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\forms\__init__.py", line 12, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\forms\flexform.py", line 6, in <module>
  File "C:\Users\cmaltez\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\RevitPythonWrapper\extra\rpw.zip\rpw\ui\forms\resources.py", line 41, in <module>
  File "C:\Program Files\Autodesk\Revit 2021\AddIns\DynamoForRevit\IronPython.StdLib.2.7.9\wpf.py", line 11, in <module>
ImportError: No module named _wpf

Which is odd because it seems I have the package located in the directory from the install. enter image description here

This is what my Dynamo looks like. its the getting started file that comes with RPW. enter image description here

Here is what I've tried so far:

  1. I've added this path to my searching path here: "C:\Program Files (x86)\IronPython 2.7\Platforms\Net40" according to this post.

Here is an image of my searching path: enter image description here

RPS works in Revit but doesn't work in dynamo for debugging python scripts.

Here are the contents of wpf.py

#-*- coding: ISO-8859-1 -*-

def _():
    import sys
    if sys.platform == 'cli':
        import clr
        clr.AddReference('IronPython.Wpf') 
        
_()
del _

from _wpf import *

any and all help would be appreciated!

Upvotes: 0

Views: 782

Answers (1)

Cflux
Cflux

Reputation: 1532

So after hours of testing different things, I finally tried to just open the wpf.py file and change the line:

from _wpf import *

to

from wpf import *

and I'm now able to access rpw in dynamo.

but I cant get the debugger working in pycharm still.

I also added the paths to the Net40 folder, the unzipped rpw folder that comes in the install, and the location of my iron python folder

enter image description here

Upvotes: 0

Related Questions