ScriptEditor call stack: what is the repeating doc(self)?

I set a breakpoint on a line, executed a script, and the call stack shows a stack of stacks, all starting with doc(self).

If I click on the doc(self) lline, I don’t see any variables. If I click on any of the other lines, I do see some variable values, but… they don’t make any sense… what do they refer to?

I would expect to see only one call stack. I think the one at the top, all the lines above the first doc(). I don’t understand why there are so many call stacks.

If I attach the PyCharm debugger, I only see one frame, which is what I was expecting.

Here is the stack of stacks:


PS
As a side note, yes, it is possible to use PyCharm or VSCode as Rhino’s debugger, perhaps I will reply to this post with the instructions.

Here is the debug panel in PyCharm when stopping at the same breakpoint:

Hmm that does not look right. Let me take a look. Which Rhino version is this and also would you mind sending me a script that I can use to replicate the issue?

The problem still reproduces with the latest WIP build:

SystemInfo

Rhino 9 SR0 2026-7-28 (Rhino 9 BETA, 9.0.26209.18303, Git hash:master @ 6df6360b2b50949f0737260b2d7af95d8142d1ac)
License type: Commercial, build 2026-07-28
License details: Cloud Zoo
Expires on: 2026-09-11

Windows 10 (10.0.19045 SR0.0) or greater (Physical RAM: 32GB)
.NET 10.0.10

Computer platform: LAPTOP - Plugged in [79% battery remaining]

Non-hybrid graphics configuration using DirectX
Primary display: NVIDIA GeForce RTX 3080 Laptop GPU (NVidia) Memory: 8GB, Driver date: 5-19-2026 (M-D-Y). DirectX(11)
> Integrated accelerated graphics device with 1 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port

Secondary graphics devices.
Intel(R) UHD Graphics (Intel) Memory: 1GB, Driver date: 12-23-2021 (M-D-Y).
> Integrated graphics device with 4 adapter port(s)
- Secondary monitor is laptop’s integrated screen or built-in port
- Secondary monitor attached to adapter port #1
Intel(R) UHD Graphics (Intel) Memory: 1GB, Driver date: 12-23-2021 (M-D-Y).
> Integrated graphics device with 4 adapter port(s)
- Secondary monitor is laptop’s integrated screen or built-in port
- Secondary monitor attached to adapter port #1

DirectX Settings
Safe mode: Off

OpenBLAS: OpenBLAS 0.3.30 DYNAMIC_ARCH NO_AFFINITY SkylakeX MAX_THREADS=64.

Rhino plugins that do not ship with Rhino
C:\Users\StefanoMenci\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\BlockEditNew\2.1.7\blockeditnew.rhp “BlockEditNew” 2.0.0.0
C:\Users\StefanoMenci\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\IntelliClad\0.0.11-beta\IntelliClad.TestInput.rhp “IntelliClad.TestInput” 1.0.0.0
C:\Users\StefanoMenci\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\Rhino-MCP-Platform\0.2.1-wip\net8.0\RhinoMcpPlatform.rhp “RhinoMcpPlatform” 0.2.1.0
C:\Users\StefanoMenci\AppData\Roaming\McNeel\Rhinoceros\packages\9.0\CommandHistoryMD\0.1.0\CommandHistoryMD.rhp “CommandHistoryMD” 0.1.0.0

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 9 WIP\Plug-ins\Commands.rhp “Commands” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 9 WIP\Plug-ins\3dxRhino.9.rhp “3DxRhino.9”
C:\Program Files\Rhino 9 WIP\Plug-ins\UpdatesAndStatistics\UpdatesAndStatistics.rhp “UpdatesAndStatistics” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 9 WIP\Plug-ins\MeshCommands.rhp “MeshCommands” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoCycles.rhp “RhinoCycles” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoCode\RhinoCodePlugin.rhp “RhinoCodePlugin” 9.0.26209.18303
C:\Program Files\Rhino 9 WIP\Plug-ins\Displacement.rhp “Displacement”
C:\Program Files\Rhino 9 WIP\Plug-ins\SectionTools.rhp “SectionTools”

Here is how to reproduce it:

  • Open the file in ScriptEditor breakpoint_test.py (21.6 KB)
  • Set a breakpoint, for example, at line 332.
  • Click Debug active script to start debugging → Execution stops at the breakpoint, and both the call stack and variables panels look correct.
  • Click Continue debugging (the same button, with a different tooltip) → The code advances to the next loop iteration and stops at the same line, but the call stack now contains the unexpected doc(self) item.
  • Click Continue debugging once more → The call stack now contains two doc(self) sections.

The steps above reproduce the problem when using either the toolbar buttons or the corresponding options in the Run menu. However, the behavior is different when invoking the same commands with keyboard shortcuts.

While writing this reply, I tried using the keyboard shortcuts instead of the buttons, but kept encountering another problem.

If I start by pressing Shift+F5, execution begins and appears to stop somewhere. I cannot tell whether it has stopped at the breakpoint because the editor does not highlight the line. If I then press F5, the UI sometimes becomes unresponsive. The only way I have found to revive Rhino is to minimize ScriptEditor using its Windows taskbar button, then click the button again to restore it. The UI becomes responsive again, and I can stop execution.

It usually freezes after pressing Shift+F5 followed by F5, although it sometimes freezes immediately after the first Shift+F5 or only after pressing F5 several times. Both the ScriptEditor and Rhino windows become unresponsive. After minimizing and restoring ScriptEditor, I see a burst of output in Rhino’s command window, apparently caused by all the pending keystrokes entered while the UI was frozen.

Thanks for reporting @Stefano_Menci
Looking at both these issues under this ticket and will report back
RH-97648

Pushed a fix for the wrong/corrupt call stack to Rhino BETA.

Also pushed a fix for UI getting stuck on debugging using shortcut keys. Had something to do with how WPF handles menu items on Windows.

I can send you an internal BETA build if you want to test these out before the next release.

I can test it if you want me to, but I don’t need it.

Right now I’m working on other things that don’t need the script editor.

RH-97648 is fixed in Rhino BETA