Dynamo - pyRevit interferance / bug

Hi! I’ve noticed that i cannot run python code-blocks inside of dynamo when i have pyrevit installed. I’ve been trying in Revit 2023,2024, and 2025. I get the error below, and as soon as i uninstall pyRevit, everything runs fine. Have anyone experienced this before, or know how to solve it? See the code i’ve used to reproduce the problem below (it does not have to be that code specific but rahter anything that tries to interact with the api). Moreover, it seems to somehow be related to CPython3, since it works fine in IronPython in Revit 2023.

Error:
SystemError: returned a result with an error set [’ File “”, line 8, in \n’]

Code:

import sys  
import clr  
clr.AddReference('RevitServices')  
clr.AddReference('RevitNodes')  
clr.AddReference('RevitAPI')  
from RevitServices.Persistence import DocumentManager  
from RevitServices.Transactions import TransactionManager  
from Autodesk.Revit.DB import *  
  
  
doc = DocumentManager.Instance.CurrentDBDocument  
  
categories = [BuiltInCategory.OST_DoorTags, BuiltInCategory.OST_WindowTags]  
out_list = []  
out_elements =[]  
  
for category in categories:  
    collector = FilteredElementCollector(doc).OfCategory(category).WhereElementIsNotElementType()  
    out_list.append(collector)  
    out_elements.append(collector.ToElements())  
  
  
OUT = out_list, out_elements

I’m guessing you have installed an incompatible version of PyRevit, or another addin. Disable all add-ins, remove PyRevit, clean/rename any PyRevit settings or data left behind, and then install the right version of PyRevit. Then test Dynamo with just that installed and see if it works.

The community on their forum is very helpful in diagnosing these types of issues - follow one of the links above.

I have the latest version of pyRevit, but ill try uninstall and clean up any traces of it, as well as removing any other plugins, and then reinstall. Hopefully it’ll work. Thanks

I’ve tried cleaning up my addins and doing a fresh install, still no luck. I’ll try the pyrevit forums!

1 Like

If anyone fins the thread, its a known bug, with no solutions (other than uninstalling pyrevit).

Update: I’ve found that if i remove all extensions i’ve made through pyrevit, together with their corresponding paths from the pyrevitsettings i can run dynamo-scripts without encountering the same issue! Might not be the best solution but atleast its a decent workaround :slight_smile:

The good news is that also indicates the issue is mostly likely on the pyrevit side given its a pyrevit specific change that resolves it.

Try loading an extension with no cpython3 in it in pyrevit and see if it still works also. I suspect its the way pyrevit is loading/calling its interpreter if python2 based extensions still work. I believe all of pyrevits inbuilt tools use ironpython.

1 Like