Command for safe boot
alexpul last edited by alexpul
Is it possible to do a safe boot (or a soft reboot) from the command line? I know that you can accomplish these with Ctrl+F and Ctrl+D, respectively, but I would like to include a safe boot in my script so I need a command line option.
machine.reset()is a command line reset but it does a hard reset and I don't want
robert-hh last edited by robert-hh
from machine import reset def safe_boot.py() # create a special main.py and reset f= open("no_main.py", "w") f.write('''import os\nos.remove("no_main.py")\n''') f.close() reset()
import machine import os try: f = open("no_main.py") f.close() machine.main("no_main.py") except OSError: # do the previous boot.py stuff here
robert-hh last edited by
@alexpul No, but it would be easy to add something like machine.safe_boot(). It would more or less only consist of the name definition, and a function with a single statement, which just calls another function.