CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Adafruit Feather nRF52840 Express with nRF52840
Code/REPL
import sys
sys.print_exception
Behavior
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'print_exception'
Description
We were using the sys.print_exception function to add tracebacks to our log entries, similar to what CPython allows. Unfortunately this (and a whole other bunch of stuff) seems to have been removed from the sys module around about commit b35fa44.
print_exception is included according to the latest MicroPython docs, although their module is called usys and not just sys. I did try to import usys instead:
>>> import usys
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'usys'
I also tried the traceback module from micropython-lib, although that just calls sys.print_exception anyway. It also uses sys.exc_info in its print_exc function, which is also not present in CircuitPython.
If these facilities have been removed intensionally, is there some other recommended way in CircuitPython to capture a traceback for reuse? Alternatively, if they are still present, where can they be located?
Additional information
No response
CircuitPython version
Code/REPL
Behavior
Description
We were using the
sys.print_exceptionfunction to add tracebacks to our log entries, similar to what CPython allows. Unfortunately this (and a whole other bunch of stuff) seems to have been removed from thesysmodule around about commit b35fa44.print_exceptionis included according to the latest MicroPython docs, although their module is calledusysand not justsys. I did try to importusysinstead:I also tried the traceback module from micropython-lib, although that just calls
sys.print_exceptionanyway. It also usessys.exc_infoin itsprint_excfunction, which is also not present in CircuitPython.If these facilities have been removed intensionally, is there some other recommended way in CircuitPython to capture a traceback for reuse? Alternatively, if they are still present, where can they be located?
Additional information
No response