Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8621

MicroPython • Re: MicroPython/RPi Pico sys.exit()

$
0
0
I have been pulling my hair out for weeks trying to figure out why my code kept looping when run on batteries. The approach you described above worked for me! Thank you!!
print("In 'main.py'")
try:
import yourcode
except SystemExit:
print("Caught 'sys.exit'")
print("Exit 'main.py'")

Statistics: Posted by Matt55124 — Sat Mar 22, 2025 10:23 pm



Viewing all articles
Browse latest Browse all 8621

Trending Articles