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'")
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