I just started to work with RhinoInside Revit recently. I’d like to reuse my python scripts (work perfectly with Rhino6, Rhino7 WIP) but ran into some problems while importing standard modules like random, json.
Would someone have an idea of what’s happening? I’d love to know the reason behind this and how I can work around it. My apologies if the question is silly.
Message: sequence item 0: expected bytes or byte array, str found
line 160, in <module>, "C:\Program Files\Rhino 7 WIP\Plug-ins\IronPython\Lib\hashlib.py"
line 49, in <module>, "C:\Program Files\Rhino 7 WIP\Plug-ins\IronPython\Lib\random.py"
Message: expected str, got bytes
line 18, in _floatconstants, "C:\Program Files\Rhino 7 WIP\Plug-ins\IronPython\Lib\json\decoder.py"
line 22, in <module>, "C:\Program Files\Rhino 7 WIP\Plug-ins\IronPython\Lib\json\decoder.py"
line 108, in <module>, "C:\Program Files\Rhino 7 WIP\Plug-ins\IronPython\Lib\json\__init__.py"
I’m trying to replicate this issue on my machine. Does this happen in fresh Revit with RIR freshly loaded, with a new python component inside Grasshopper that only imports
It seems to me that other python scripts have executed before this that might have modified the behaviour of builtin python functions.
It happens with fresh Revit 2019 (architecture template) and RIR. As far as I’m aware, there’s no other process being executed before.
The error occurs with both Rhino Python Editor as well as the ghPython component.
Okay I was able to figure out the source of this issue. The problem seems to be conflict with version of IronPython that is shipped with Dynamo (2.7.3)
Rhino is shipped with 2.7.9 and the IronPython libraries belong to this version. So they natually cause an error when being loaded into an older IronPython version.
As a workaround you can disable Dynamo and RIR will work properly.
Thank you, disabling Dynamo solved the issues!