# Python engine automatically updating to CPython3

**URL:** <https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713>\
**Category:** Revit\
**Tags:** python, cpython3\
**Created:** [November 3, 2022, 3:44am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713 "2022-11-03T03:44:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 3:44am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/1 "2022-11-03T03:44:00Z")

</div>

It seems 2.13 is changing all python nodes to 3. is there a setting to keep them as 2.7 instead of relying on people to update their packages for nodes to work again?

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 3, 2022, 4:55am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/2 "2022-11-03T04:55:15Z")

</div>

You can install the IronPython 2 package to keep things working, but best to convert what you can as you can to CPython 3 to prevent security issues down the line.

The graphs I shared in the other thread shoudl give you some tools to bulk update and test the updated graphs.

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 6:13am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/3 "2022-11-03T06:13:42Z")

</div>

It let’s it work but dosnt change the automatic change to 3 🙁

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 3, 2022, 7:18am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/4 "2022-11-03T07:18:10Z")

</div>

Nodes shouldn’t be automatically changing to three - did you accidentally run an upgrade tool on it?

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 7:27am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/5 "2022-11-03T07:27:51Z")

</div>

I don’t think so. Just copied the scripts and packages then opened in 2.13. Then noticed nodes wernt working. Then went inside and they were python 3. Then copied the python in the node out into the graph and changed to python 2.7 and worked

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 3, 2022, 7:37am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/6 "2022-11-03T07:37:42Z")

</div>

Hi,  
probably because Python custom nodes syntax is XML (old structure) instead of JSON

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 3, 2022, 7:39am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/7 "2022-11-03T07:39:33Z")

</div>

So a Dynamo 1.x upgrade to 2.13 pushes the engine to CPytthon 3? Does this reproduce (literally shut down the laptop 2 seconds ago or I’d check myself)?

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 3, 2022, 7:40am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/8 "2022-11-03T07:40:53Z")

</div>

yes 🙄

> [@Custom Nodes : Conversion Xml to Json architecture](https://forum.dynamobim.com/t/custom-nodes-conversion-xml-to-json-architecture/75610):
>
> Hello all I share a Python script to convert old dyf(s) with Xml architecture to new Json architecture (custom node). Conversion to launch from Dynamo Revit higher than 2.04. Note With Dynamo 2.13+ if your custom nodes are written with IronPython2 engine and the dyf’s format is Xml (old dyf architecture) this will default affect to the CPython3 engine instead of the ipy2 engine. \_\_author\_\_ = "Cyril POUPIN" \_\_license\_\_ = "MIT" \_\_version\_\_ = "0.5" import clr import sys import System from Sy…

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 3, 2022, 7:42am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/9 "2022-11-03T07:42:42Z")

</div>

Split this to a new topic as it feels important enough to track/watch separately.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 3, 2022, 7:47am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/10 "2022-11-03T07:47:12Z")

</div>

The Bulk Python Engine updater in the ZIP I posted here can certainly be revised to allow the bulk downgrade to IronPython from CPython. Filing this one as one more reason to upgrade graphs in your library at each release.

> [@Updating python node in multiple scripts](https://forum.dynamobim.com/t/updating-python-node-in-multiple-scripts/82637/15):
>
> That’s the ‘work’ account which exists solely because it has to, and since I had info I thought might keep you hopeful I wanted to share it out before you got discouraged. First some background. Managing Dynamo repositories is hard, as each release can require modifying your code base, similar to what developers of add-ins go through. However we (development, seasoned users, community leaders) haven’t done a good job showing how this is best accomplished. My small section of this class aimed t…

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 3, 2022, 7:54am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/11 "2022-11-03T07:54:22Z")

</div>

I don’t think it’s so simple by editing the dyn, (you need to convert from XML to JSON format)

it would be easier to handle this directly in DynamoServices library  
`if IsXmlContent(dyffile) → use IronPython2 engine`

@Michael_Kirschner2 do you think it’s possible ?

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 8:01am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/12 "2022-11-03T08:01:21Z")

</div>

I don’t have my laptop but I think the node was dynamo 2 somthing but I’ll have to double check tomorrow. Will try reverse script too

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 8:17am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/13 "2022-11-03T08:17:26Z")

</div>

How do you do this? Would you be able to deploy the settings to other people?

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 3, 2022, 8:20am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/14 "2022-11-03T08:20:39Z")

</div>

It’s just an idea for DynamoTeam

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 3, 2022, 1:17pm UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/15 "2022-11-03T13:17:29Z")

</div>

> [@c.poupin](#):
>
> I don’t think it’s so simple by editing the dyn, (you need to convert from XML to JSON format)

This was for already updated graphs.

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [November 3, 2022, 2:06pm UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/16 "2022-11-03T14:06:31Z")

</div>

so I think theres 2.5 issues here

1. a bug - that somehow opening an xml based graph in 2.13 and later will force python engine to version cpython3 - I think this is a bug… very little chance of this working - so if it was by design, not a great one.

2. You are looking for some solution to fix graphs that have been effected by this bug and saved in json.

2a. You are looking for a solution to not change the python engine version when opening these files - in already released version of Dynamo (2.13) - hard.

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 6:35pm UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/17 "2022-11-03T18:35:50Z")

</div>

That’s rough. Hopes and prers it’s not affecting to many graphs. Or any custom nodes I can’t get into 😱

Could we get a patch or something? Isn’t this quite major?

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 3, 2022, 7:54pm UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/18 "2022-11-03T19:54:08Z")

</div>

I wonder if I didn’t have the python 2.7 package installed before opening dynamo the first time it might not switch the nodes to python 3?

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 4, 2022, 12:53am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/19 "2022-11-04T00:53:59Z")

</div>

I haven’t seen this at scale other then what you’re posting; Dynamo 1.3 stopped being officially supported about 9 months ago when 2019 stopped being supported. If you’ve done any work in 2020, 2021, and 2022 the graphs would have updated from XML to JSON then there isn’t any XML to update to JSON and the default python engine wouldn’t be an issue.

Incremental upgrades of your library and ensuring you’re on current packages should prevent the issue, but it’s likely you’re too far along for that now.

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [November 4, 2022, 1:08am UTC](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713/20 "2022-11-04T01:08:09Z")

</div>

Got slightly lost in that. However a legend script I made was done in 2022 and upgraded to 2023 and the python engine was changed in a node. Sorry not sure if you obviously stated that. The XML to JSON is out of my understanding

[Next page](https://forum.dynamobim.com/t/python-engine-automatically-updating-to-cpython3/82713.md?page=2)
