Pyrevit vs CPython3

Hello all

In Revit I use pyrevit, in which I create my own tab. Since I have pyrevit installed, unfortunately no node in CPython3 works. If I uninstall pyrevit everything works as it should. All nodes in CPython3 reports the same error (see picture). Does anyone know how to solve the problem please?

Thank you
Lucie

Make sure you’re on the latest build of PyRevit and that Revit is fully up to date. If that doesn’t solve it I recommend asking in the PyRevit forums as there is likely a conflict which needs to be resolved and the users there will likely know best. :slight_smile:

@Lucy_Lastparametrics are u using __ import __ inside this node…??

Thank you for your answers. Here is the code for example. But I have this issue with all the codes in Cpython3. When I switch to Python 2 it works.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

names = []
cats = []
vag = []
pgs = []
pts = []
isvis = []
elems = []
guids = []
isinst = []
iterator = doc.ParameterBindings.ForwardIterator()
while iterator.MoveNext():
        vag.append(iterator.Key.VariesAcrossGroups)
        names.append(iterator.Key.Name)
        pgs.append(iterator.Key.ParameterGroup)
        pts.append(iterator.Key.GetType)
        isvis.append(iterator.Key.Visible)
        elem = doc.GetElement(iterator.Key.Id)
        elems.append(elem)
        if elem.GetType().ToString() == 'Autodesk.Revit.DB.SharedParameterElement':
                guids.append(elem.GuidValue)
        else: guids.append(None)
        if iterator.Current.GetType().ToString() == 'Autodesk.Revit.DB.InstanceBinding':
                isinst.append(True)
        else:
                isinst.append(False)
        thesecats = []
        for cat in iterator.Current.Categories:
                try:
                        thesecats.append(Revit.Elements.Category.ById(cat.Id.IntegerValue))
                except:
                        thesecats.append(None)
        cats.append(thesecats)
OUT = (names, cats, elems, isinst)

@Lucy_Lastparametrics: did you solved this problem? If so, how?

I would suggest raising it on pyrevit forums as mentioned before with an example of the issue exhibiting itself, and it is likely dependency related. Personally I’ve been able to run CPython3 before in pyRevit so make sure you are on latest stable build also if not.

Be mindful that currently pyRevit is under development for Revit 2025 and you will be unlikely to get any solutions from the developers until then as it is open source and only developed when people find time/contribute. The priority currently for them is definitely R25/Netcore support.