OpenSite/Guides/Edit Python scripts
Use editor assistance, search and run scope to make a script repeatable.
- Stable identifier
opensite.help.edit-python-scripts
Prerequisites
The Python workbench. Use a practice UTF-8 script and a trusted embedded runtime.
Steps
Create or open a file
Choose the Python workbench, then New script or Open script. A script opens in a central tab. Save script/Save script as controls are distinct from engineering-document Save.
Choose the run scope
| Action | Editor shortcut |
|---|---|
| Run file | Ctrl+Enter |
| Run selection | Ctrl+Shift+Enter |
| Run current line | Shift+Enter |
Put the editor in focus. Running a buffer does not save it. A selection may omit setup code that the complete file needs.
Use assistance appropriately
Ctrl+Space requests completion; Ctrl+Shift+Space requests signature help. F12 requests a definition lookup. Assistance is for the current file and supported runtime help, not a project-wide language server or proof that your code is correct.
Find and correct text
Ctrl+F opens Find; Ctrl+H opens Replace. Match-case/whole-word options are available; regular expressions are not. Ctrl+G opens Go to line. Inspect a Replace All result before running the modified script.
Save and inspect output
Save a named file so traceback paths and breakpoints are meaningful. Workbench stdout/stderr appears in the shared Output panel. Use OpenSite/Guides/Inspect Output.
Debug when needed
Use the saved file’s breakpoints and Debug file; see OpenSite/Guides/Debug a Python script. Do not start another run while the shared lane is paused or busy.
Expected result
You can edit/save a script, select the intended run scope and find its diagnostic output.
Limitations
Save As changes the script path and breakpoint association. An unsaved or closed editor buffer is not stored inside an engineering document.