Error with io module in Revit2025

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)

3 Likes

Yeah, that works with Cpython3.

Yeah, if I change it to CPython3 it works.