when main.py Program error ,how to restart it

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
ambob
Posts: 5
Joined: Mon Oct 08, 2018 11:23 pm

when main.py Program error ,how to restart it

Post by ambob » Fri Nov 02, 2018 12:18 am

main.py in programming
for some reason,it error
now main.py maybe in endless loop
in this time it seemed will not restart
how to do

main.py在运行过程中,在循环了几次之后 可能因为各种原因报错退出了
目前看到的就是,退出后不再执行任何程序
那么怎么做呢?让他重新运行起来

User avatar
Roberthh
Posts: 1122
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: when main.py Program error ,how to restart it

Post by Roberthh » Fri Nov 02, 2018 7:25 am

When main.py eventually finishes, you can delete or rename it from the REPL
delete: uos.remove("main.py")
rename: uos.rename("main.py", "newname.py")
The board does not need main.py to start. And it is a common practice to put in main.py just an import statement for your bulk code. Besides that, you should in most cases be able to stop a running script with Ctrl-C from the console.

Post Reply