Page 1 of 1

Print exceptuons from main.py to serial

Posted: Mon Feb 20, 2017 11:04 am
by amartino
Hello all :)

Is there a way to have the exceptions in main.py be printed on the serial console?
This is the best idea I have so far for debugging non reproducible issues with main.py

Re: Print exceptuons from main.py to serial

Posted: Mon Feb 20, 2017 7:34 pm
by dhylands
You can put the REPL on a UART using os.dupterm() (also pyb.repl_uart on pyboard), and then everything that shows up on the REPL will also show up on the serial port.

There is also sys.print_exception: http://docs.micropython.org/en/latest/p ... _exception