LoPy Using machine.main(filename)
-
-
Default boot.py file looks like below:
from machine import UART import os uart = UART(0, 115200) os.dupterm(uart)Try:
import machine import os uart = machine.UART(0, 115200) os.dupterm(uart) machine.main(filename) -
Thanks,
tried this already in various syntax options,
import machine
import os
uart = machine.UART(0, 115200)
os.dupterm(uart)
machine.main(test.py)
or
machine.main('test.py')
or
machine.main('./test.py')etc.
Even removed main.py from the file system
but no succes.The basic idea that want to implement is running various
version of software depending in grounding pins.
This is the first step i need to solve. -
You do not need to override it to acomplish task
use
execfile('your file.py')
in your boot.py -
-
Thanks,
just tested this and works like a charm.
-
-
@Rens said in LoPy Using machine.main(filename):
Still curious why this is not working, i assume when execfile('test.py')
would return still will go on with main.py.Thanks for all suggestions !
OK, as I promised I've tried my LoPy with boot.py as below:
import machine import os uart = machine.UART(0, 115200) os.dupterm(uart) machine.main('test.py')with test.py file:
print('Test')and everything is working as it should.

-
Thanks for trying, no idea were I did go wrong.
Will test and have another close look, as far is i can see
both setup's are identical.When do find the answer I will post it here.
Regards Rens
-
Well just tested again with machine.main('test.py') and now its
working as i would expect. Thanks again for the support.Rens
-
@Rens said in LoPy Using machine.main(filename):
Well just tested again with machine.main('test.py') and now its
working as i would expect. Thanks again for the support.Rens
Super! I'm glad that you finally did it! :o)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login