Harald
May 20, 2025, 11:46am
1
I have been using this code for IronPython2 and it works up until Revit 2024 but not in Revit 2025 anymore.
Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
from io import StringIO
sys.stdout = StringIO()
The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
The error given is:
“Importerror: No module named io”
Does anybody know what is the cause of this?
Not sure about python 2, but it works fine with Cpython3 in Revit 2025?
Just as a test, do you get the same?
Cheers,
Mark
Hi @Harald
IronPython2.7 is obsolete, it is no longer maintained by the IronPython team, and it is not really sure that it will be compatible with future versions of Net Core 9+ ,
Revit 2025+ marks a new departure (NetCore), and this is an opportunity to migrate to Python3:
CPython3 (or better PythonNet3)
IronPython3
1 Like
I reported the issue here, with a temporary workaround, but you should still migrate to Python3 (see my previous post)
opened 07:08AM - 21 May 25 UTC
Hi,
## Dynamo version
DynamoSanbox 3.4.1
## IronPython version
2.7
## Dy… namoIronPython2 Package version
3.2.1
## Operating system
Win 10
## What did you expect to see?
IronPython.StdLib is not loaded by default

## code to reproduce
```
import sys
import clr
try:
import functools
except Exception as e:
OUT = e, sys.version, sys.path
```
## workaround adding the correct **StdLib path** in `sys.path`
```
import sys
import clr
import System
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)
#
ipy2_assembly = System.AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(lambda a : a.GetName().Name == 'IronPython.Modules')
assembly_ipy2_Directory = System.IO.Path.GetDirectoryName( ipy2_assembly.Location )
parent_ipy2_Directory = System.IO.Directory.GetParent(assembly_ipy2_Directory).FullName
#
if System.IO.Directory.Exists(parent_ipy2_Directory + "\\lib"):
sys.path.append(parent_ipy3_Directory + "\\lib")
if System.IO.Directory.Exists(parent_ipy2_Directory + "\\extra\\lib"):
sys.path.append(parent_ipy2_Directory + "\\extra\\lib")
if System.IO.Directory.Exists(parent_ipy2_Directory + "\\extra"):
sys.path.append(parent_ipy2_Directory + "\\extra")
import functools
import io
```
3 Likes
Yeah, that works with Cpython3.
Yeah, if I change it to CPython3 it works.