<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[LoPy Using machine.main(filename)]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">anyone succesfull in using <strong>machine.main(filename)</strong> from <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a>.<br />
No matter what it always seems boot <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>.</p>
<p dir="auto">Runnig LoPy version 0.97.b1</p>
]]></description><link>https://forum.pycom.io/topic/348/lopy-using-machine-main-filename</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 16:51:53 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/348.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Dec 2016 11:19:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Mon, 05 Dec 2016 11:19:52 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">anyone succesfull in using <strong>machine.main(filename)</strong> from <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a>.<br />
No matter what it always seems boot <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>.</p>
<p dir="auto">Runnig LoPy version 0.97.b1</p>
]]></description><link>https://forum.pycom.io/post/1982</link><guid isPermaLink="true">https://forum.pycom.io/post/1982</guid><dc:creator><![CDATA[Rens]]></dc:creator><pubDate>Mon, 05 Dec 2016 11:19:52 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Mon, 05 Dec 2016 21:42:56 GMT]]></title><description><![CDATA[<p dir="auto">Default <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a> file looks like below:</p>
<pre><code>from machine import UART
import os
uart = UART(0, 115200)
os.dupterm(uart)
</code></pre>
<p dir="auto">Try:</p>
<pre><code>import machine
import os
uart = machine.UART(0, 115200)
os.dupterm(uart)
machine.main(filename)
</code></pre>
]]></description><link>https://forum.pycom.io/post/1995</link><guid isPermaLink="true">https://forum.pycom.io/post/1995</guid><dc:creator><![CDATA[rskoniec]]></dc:creator><pubDate>Mon, 05 Dec 2016 21:42:56 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Mon, 05 Dec 2016 21:54:48 GMT]]></title><description><![CDATA[<p dir="auto">Thanks,</p>
<p dir="auto">tried this already in various syntax options,</p>
<p dir="auto">import machine<br />
import os<br />
uart = machine.UART(0, 115200)<br />
os.dupterm(uart)<br />
machine.main(<a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a>)<br />
or<br />
machine.main('<a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a>')<br />
or<br />
machine.main('./test.py')</p>
<p dir="auto">etc.</p>
<p dir="auto">Even removed <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> from the file system<br />
but no succes.</p>
<p dir="auto">The basic idea that want to implement is running various<br />
version of software depending in grounding pins.<br />
This is the first step i need to solve.</p>
]]></description><link>https://forum.pycom.io/post/1997</link><guid isPermaLink="true">https://forum.pycom.io/post/1997</guid><dc:creator><![CDATA[Rens]]></dc:creator><pubDate>Mon, 05 Dec 2016 21:54:48 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Mon, 05 Dec 2016 21:57:40 GMT]]></title><description><![CDATA[<p dir="auto">You do not need to override it to acomplish task<br />
use<br />
<code>execfile('your file.py')</code><br />
in your <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a></p>
]]></description><link>https://forum.pycom.io/post/1998</link><guid isPermaLink="true">https://forum.pycom.io/post/1998</guid><dc:creator><![CDATA[livius]]></dc:creator><pubDate>Mon, 05 Dec 2016 21:57:40 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Tue, 06 Dec 2016 10:01:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/490">@Rens</a> Like <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/199">@livius</a> said, for your scenario <code>execfile('your_file.py')</code> is more appropriate - try it. Anyway <code>machine.main('test.py')</code> should do it's job too. Because my LoPys are at work, I'll try to check that tomorrow.</p>
]]></description><link>https://forum.pycom.io/post/2002</link><guid isPermaLink="true">https://forum.pycom.io/post/2002</guid><dc:creator><![CDATA[rskoniec]]></dc:creator><pubDate>Tue, 06 Dec 2016 10:01:51 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Mon, 05 Dec 2016 22:20:46 GMT]]></title><description><![CDATA[<p dir="auto">Thanks,</p>
<p dir="auto">just tested this and works like a charm.</p>
]]></description><link>https://forum.pycom.io/post/2003</link><guid isPermaLink="true">https://forum.pycom.io/post/2003</guid><dc:creator><![CDATA[Rens]]></dc:creator><pubDate>Mon, 05 Dec 2016 22:20:46 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Mon, 05 Dec 2016 22:26:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/360">@rskoniec</a></p>
<p dir="auto">Still curious why this is not working, i assume when execfile('<a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a>')<br />
would return still will go on with <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>.</p>
<p dir="auto">Thanks for all suggestions !</p>
]]></description><link>https://forum.pycom.io/post/2005</link><guid isPermaLink="true">https://forum.pycom.io/post/2005</guid><dc:creator><![CDATA[Rens]]></dc:creator><pubDate>Mon, 05 Dec 2016 22:26:21 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Tue, 06 Dec 2016 10:00:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/490">@Rens</a> said in <a href="/post/2005">LoPy Using machine.main(filename)</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/360">@rskoniec</a></p>
<p dir="auto">Still curious why this is not working, i assume when execfile('<a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a>')<br />
would return still will go on with <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a>.</p>
<p dir="auto">Thanks for all suggestions !</p>
</blockquote>
<p dir="auto">OK, as I promised I've tried my LoPy with <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a> as below:</p>
<pre><code>import machine
import os

uart = machine.UART(0, 115200)
os.dupterm(uart)

machine.main('test.py')
</code></pre>
<p dir="auto">with <a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a> file:</p>
<pre><code>print('Test')
</code></pre>
<p dir="auto">and everything is working as it should.</p>
<p dir="auto"><img src="/uploads/files/1481018401986-main-resized.jpg" alt="0_1481018401638_main.jpg" class="img-responsive img-markdown" /></p>
]]></description><link>https://forum.pycom.io/post/2016</link><guid isPermaLink="true">https://forum.pycom.io/post/2016</guid><dc:creator><![CDATA[rskoniec]]></dc:creator><pubDate>Tue, 06 Dec 2016 10:00:24 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Tue, 06 Dec 2016 12:45:12 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for trying, no idea were I did go wrong.</p>
<p dir="auto">Will test and have another close look, as far is i can see<br />
both setup's are identical.</p>
<p dir="auto">When do find the answer I will post it here.</p>
<p dir="auto">Regards Rens</p>
]]></description><link>https://forum.pycom.io/post/2019</link><guid isPermaLink="true">https://forum.pycom.io/post/2019</guid><dc:creator><![CDATA[Rens]]></dc:creator><pubDate>Tue, 06 Dec 2016 12:45:12 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Tue, 06 Dec 2016 20:08:26 GMT]]></title><description><![CDATA[<p dir="auto">Well just tested again with machine.main('<a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a>') and now its<br />
working as i would expect. Thanks again for the support.</p>
<p dir="auto">Rens</p>
]]></description><link>https://forum.pycom.io/post/2023</link><guid isPermaLink="true">https://forum.pycom.io/post/2023</guid><dc:creator><![CDATA[Rens]]></dc:creator><pubDate>Tue, 06 Dec 2016 20:08:26 GMT</pubDate></item><item><title><![CDATA[Reply to LoPy Using machine.main(filename) on Tue, 06 Dec 2016 21:24:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/490">@Rens</a> said in <a href="/post/2023">LoPy Using machine.main(filename)</a>:</p>
<blockquote>
<p dir="auto">Well just tested again with machine.main('<a href="http://test.py" target="_blank" rel="noopener noreferrer nofollow">test.py</a>') and now its<br />
working as i would expect. Thanks again for the support.</p>
<p dir="auto">Rens</p>
</blockquote>
<p dir="auto">Super! I'm glad that you finally did it! :o)</p>
]]></description><link>https://forum.pycom.io/post/2026</link><guid isPermaLink="true">https://forum.pycom.io/post/2026</guid><dc:creator><![CDATA[rskoniec]]></dc:creator><pubDate>Tue, 06 Dec 2016 21:24:41 GMT</pubDate></item></channel></rss>