Issues with API in CPython3 after Transition from IronPython 2.7 in Revit 2023

Hello everybody!

I’ve been encountering an issue with my Dynamo Scripts in CPython3 after transitioning from IronPython 2.7 in Revit 2023, and I could use some guidance. Same problem as this post.

We work in a Citrix Environment where every machine receives a fresh installation of Revit 2023 on startup. My idea was to ensure that the IronPython 2.7 package is copied into the appropriate directory during the startup process. Since the Dynamo scripts are configured to use this version, I expected them to work (which did happen when I manually changed the version).
However, it hasn’t worked as expected, and I’m facing errors on some machines, particularly when using Revit API calls.

I’d like to explore a few potential solutions and would appreciate your insights:

Is there a way to configure the Revit 2023 installation process to skip or exclude CPython3?
Alternatively, is there a method to uninstall or remove CPython3 shortly after the Revit 2023 installation? This would ensure only IronPython 2.7 is available, ideally resolving the compatibility issues.

Maybe there is a different approach I did not think of, any help would be welcome!

Pulling Python out of Dynamo for Revit is more likely going to break ALL of the Python stuff than make it so IronPython 2 works. Instead you’d be better off making sure your packages deploy correctly, or that your Dynamo graphs specify the engine correctly (which means you need a different graph version for each Revit release).

That said, you could try

  1. Building your own Dynamo for Revit using the Python components which were utilized for Revit 2021 (last version which only had IronPython2), but all the other features of Dynamo for Revit 2023.
  2. Build a custom Revit installer which removes Dynamo for Revit entirely, and then installs your hacked Dynamo for Revit.
  3. Test your hacked build to confirm that things work, and pick up the bugs as they arise.

All in I would expect 1/3 of your functional hours each year to be dedicated to building and maintaining this hack as it will have to be redone on each Revit release and update. Could be a fun experiment though!

1 Like