Hi,
I do a lot of try-and-error coding. Means I write a main.py and flash it on the ESP8266 with ampy. The issue is: after rebooting the ESP8266, the main.py may be started but I cannot see any error messages while main.py is executed.
It would be much better, if I access with picocom the REPL first and start from there the main.py.
My first attempt was to rename the main.py, so it doesn't get started automatically. Then I logged into the REPL with picocom, loaded os and tried os.system("main_new_name.py") ... well but os.system isn't available in µPython.
Anyhow: what is the correct approach to test µPyhton-Skripts on the ESP8266, in a way I can see in a terminal all the errors?
In advance: thanks for all your support
(Note: already searched the forum for similar issues, e.g. with the term "execute scripts" but found nothing appropriate)
ESP8266: instead of main.py start from REPL an script
Re: ESP8266: instead of main.py start from REPL an script
Hi,
If you put your code in foo.py, then on the repl run "import foo", you should get what you want.
Also you can use Ctrl-D to soft-reset.
If you put your code in foo.py, then on the repl run "import foo", you should get what you want.
Also you can use Ctrl-D to soft-reset.
Re: ESP8266: instead of main.py start from REPL an script
I recently got the ESP8266 and had a play around. I made a "note to self" of my workflow. Check it out: https://github.com/KipCrossing/ESP2866-MicroPython
I put my code in a different file just in case my main.py file got corrupted. It seems difficult to remove corrupted files.
I put my code in a different file just in case my main.py file got corrupted. It seems difficult to remove corrupted files.
-
- Posts: 169
- Joined: Fri Aug 19, 2016 11:55 am
Re: ESP8266: instead of main.py start from REPL an script
main.py will be executed automatically when the ESP8266 is powered on. Many messages will be generated long before I am able to login with picocom.Christian Walther wrote: ↑Sat Jun 29, 2019 12:53 pmThere must be something wrong here. You should see error messages or anything else printed to stdout on the serial output while main.py is running.