OpenSite/Guides/Use Python Console

From BathAfrica Documentation
Jump to navigation Jump to search
OpenSite 0.0.1 · DevelopmentSource scope and availability


Try small calculations in the interactive prompt, then move repeatable work into a script.

Stable identifier
opensite.help.use-python-console

Prerequisites

A desktop with its Python console extension and matching runtime. Use only trusted Python.

Steps

Show the console

Open the Python console from the View → Python area. Read the banner and Ready/Busy/Error status. If the build reports Python unavailable, use OpenSite/Guides/Troubleshoot startup.

Run a simple expression

At the current prompt enter 2 + 3 and press Enter. A completed expression should report 5. Earlier prompts/output remain a transcript rather than an editable script.

Enter multiline input

Shift+Enter inserts a line; Ctrl+Enter submits the current input buffer. Keep indentation correct for Python blocks. History is limited and in memory; it is not a durable script library.

Try an OpenSite quantity

import opensite
length = opensite.Q("250 mm")
print(length.value_in("m"))
# Expected: 0.25

Read errors and stop appropriately

Read the traceback and the final error, not only the first output line. The console, editor, debugger and Python expressions share one lane. Wait for a running operation or request interruption; native extension work can take time to return.

Save repeatable work elsewhere

Copy a useful sequence into a saved UTF-8 .py editor file. See OpenSite/Guides/Edit Python scripts. Console history/transcript and .osdoc saving are separate.

Expected result

You can run a small expression, recognize its output and retain repeatable work as a script.

Limitations

Clearing the console is not an interpreter reset. The interpreter keeps imports, variables and application state for the session.

Continue learning

User manual · Tutorial pathways · Get help