OpenSite/Guides/Debug a Python script
Follow a short calculation through Python-line debugging and inspect a deliberate error.
- Stable identifier
opensite.help.debug-a-python-script
Prerequisites
The desktop Python workbench with Python enabled. Save a practice script; use the Debugger rather than the Console transcript to inspect a paused stack.
Steps
Prepare a small file
lengths = [2.0, 3.0, 4.0]
for length in lengths:
squared = length * length
print(length, squared)
print("done")Start Debug file
Use the workbench’s Debug file action. At a pause, inspect the stack and variables in the Debugger panel.
Step through the loop
Step into, over or out as appropriate. Watch length and squared. Current-file assistance and runtime debugging are separate features.
Trace an intentional failure
In a separate practice file, run raise ValueError("practice failure"). Read the traceback file and line. Script Output records the failure; debugger frame selection provides navigation.
Stop and wait
Stop requests interruption. Wait for the lane to become idle before running another script or property expression.
Expected result
The loop produces (2, 4), (3, 9) and (4, 16). The error exercise identifies its own file/line without changing an engineering document.
Limitations
The debugger steps Python lines, not native solver/library instructions. Native calls may keep running until they return; a Stop request is not proof of immediate interruption.