Hello world
My application catches all Exceptions. I would like to log them and upload to remote server to have insight on the status and possible issues with sensors remotely.
Catching Exception as e and then printing str(e) only gives me the error message. But I would also like to catch the backtrace as it is produced to console without try/except. In Python there is a backtrace module for that, but I cannot find it in a MicroPython. I am sure something like this exist here because backtrace is printed out on error in REPL.
How can I catch and print out the backtrace from an exception in MicroPython?
Any hints welcome
try except and backtrace print log
try except and backtrace print log
--
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
Re: try except and backtrace print log
Here's an example for you: https://github.com/dhylands/upy-example ... int_exc.py
Look at sys.print_exception: http://docs.micropython.org/en/latest/l ... _exception
Look at sys.print_exception: http://docs.micropython.org/en/latest/l ... _exception
Re: try except and backtrace print log
Wow! Thank you Dave!!dhylands wrote: ↑Fri Jan 28, 2022 4:10 amHere's an example for you: https://github.com/dhylands/upy-example ... int_exc.py
Look at sys.print_exception: http://docs.micropython.org/en/latest/l ... _exception
--
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info