<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kfdani-001-site10.gtempurl.com/index.php?action=history&amp;feed=atom&amp;title=OpenSite%2FGuides%2FRun_your_first_script</id>
	<title>OpenSite/Guides/Run your first script - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://kfdani-001-site10.gtempurl.com/index.php?action=history&amp;feed=atom&amp;title=OpenSite%2FGuides%2FRun_your_first_script"/>
	<link rel="alternate" type="text/html" href="https://kfdani-001-site10.gtempurl.com/index.php?title=OpenSite/Guides/Run_your_first_script&amp;action=history"/>
	<updated>2026-10-30T02:05:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://kfdani-001-site10.gtempurl.com/index.php?title=OpenSite/Guides/Run_your_first_script&amp;diff=866&amp;oldid=prev</id>
		<title>BathAfrica: Add rewritten practical lesson with steps, code and expected results</title>
		<link rel="alternate" type="text/html" href="https://kfdani-001-site10.gtempurl.com/index.php?title=OpenSite/Guides/Run_your_first_script&amp;diff=866&amp;oldid=prev"/>
		<updated>2026-10-29T21:01:07Z</updated>

		<summary type="html">&lt;p&gt;Add rewritten practical lesson with steps, code and expected results&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{OpenSite scope}}&lt;br /&gt;
{{OpenSite lesson&lt;br /&gt;
|id=opensite.help.run-your-first-script&lt;br /&gt;
|summary=Run a small Python calculation and learn which output surface to read.&lt;br /&gt;
|prerequisites=An OpenSite development build with its matching embedded runtime. A system Python interpreter is not a replacement for the embedded OpenSite host.&lt;br /&gt;
|steps==== Choose console or editor ===&lt;br /&gt;
Use the interactive Console for a short expression. Use the Python workbench editor for a repeatable &amp;lt;code&amp;gt;.py&amp;lt;/code&amp;gt; file. They share one interpreter and lane.&lt;br /&gt;
&lt;br /&gt;
=== Enter the quantity lesson ===&lt;br /&gt;
Create a script containing the quantities example below. Save it before relying on its filename in tracebacks. Running an unsaved buffer does not save it.&lt;br /&gt;
&lt;br /&gt;
=== Run the current file ===&lt;br /&gt;
Choose the Python workbench Run action. The workbench also supports running a selection or a current line; verify the intended scope before running.&lt;br /&gt;
&lt;br /&gt;
=== Read Output ===&lt;br /&gt;
Workbench script stdout/stderr goes to the host Output panel, with source &amp;lt;code&amp;gt;python.script&amp;lt;/code&amp;gt;. The interactive Console transcript is separate. {{MenuCommand|View → Show Output}} shows the shared panel.&lt;br /&gt;
&lt;br /&gt;
=== Repeat deliberately ===&lt;br /&gt;
Rerun retains imports, variables and application state. Start with a fresh document or explicit variables when the example depends on a clean state.&lt;br /&gt;
&lt;br /&gt;
|result=The quantity lesson reports a total of 3650 mm. The same script can be used in the matching headless OpenSite host.&lt;br /&gt;
|limitations=A script has the privileges of the embedded host. Run only trusted code. Avoid starting a second operation while the shared execution lane is busy.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Complete example ==&lt;br /&gt;
{{Code|lang=python|code=&amp;lt;nowiki&amp;gt;import opensite&lt;br /&gt;
&lt;br /&gt;
span = opensite.parse_quantity(&amp;quot;3.2 m&amp;quot;)&lt;br /&gt;
extension = opensite.parse_quantity(&amp;quot;450 mm&amp;quot;)&lt;br /&gt;
total = opensite.add(span, extension)&lt;br /&gt;
print(f&amp;quot;Total: {total.value_in(&amp;#039;mm&amp;#039;):.0f} mm&amp;quot;)&lt;br /&gt;
assert abs(total.si_value - 3.65) &amp;lt; 1e-12&lt;br /&gt;
&lt;br /&gt;
before = total.si_value&lt;br /&gt;
opensite.execute(&amp;quot;units.set_profile&amp;quot;, {&amp;quot;profile&amp;quot;: &amp;quot;engineering_metric&amp;quot;})&lt;br /&gt;
print(&amp;quot;Display:&amp;quot;, opensite.format_quantity(total, &amp;quot;engineering_metric&amp;quot;))&lt;br /&gt;
assert total.si_value == before&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;os-page-nav&amp;quot;&amp;gt;{{Docnav|OpenSite/Guides/Dimensionless material expressions|OpenSite/Guides/Discover commands|OpenSite/Guides|All guides}}&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Category:OpenSite documentation]]&lt;/div&gt;</summary>
		<author><name>BathAfrica</name></author>
	</entry>
</feed>