Context
I’ve just transitioned to Rhino 8 from Rhino 7 and am currently refactoring our companies Rhino Python plugin for Rhino 8.
The plugin summarized:
User runs custom command from Rhino, selects a few geometry objects in the viewport, calculations and then results are shown.
Our Rhino 7 plugin already relied on custom Python 3+ libraries and worked by hosting a local server to send/receive serialized requests via socket communication from Rhino 7 (IronPython), deserialized this request and ran the calculations in Python 3 and then sent it back to IronPython.
Obviously this is (or at least should be) redundant now and can all be done in the Script Editor together with adding our custom Python libraries. During this process I’ve encountered some unclear behavior which I wanted to ask the community for support.
Issues
-
Debugger sometimes won’t show variables when stopping at a breakpoint (same script with two different breakpoints). Additionally running the code with breakpoints is definitely 10-100x slower…
I have a suspicion that this has something to do with the reloading the script engine, during development when modifying the custom python library I need to reload Python3, when I rerun the code to debug I’m faced with an empty debug variables window. However when restarting rhino 8 it works as expected.
-
TypeError: python object must be callable or have a callable write method
Issue #1 was found as I was trying to debug this TypeError which appears when I’m trying to visualize the results of my calculations. When the debug issue occurs I will receive aTypeError
however when restarting Rhino it doesn’t occur. It seems to be me there are some issues when reloading that doesn’t allow the custom python library Classes to be fully instantiated or something like that.
Debrief
- Currently to debug and develop I need to constantly restart Rhino 8 to ensure my code is running correctly. Is there an issue with reloading the script engine or am I using it incorrectly?
Happy to provide more information if needed.