Skip to content

traceback.format_exc failed due to sys.exc_info not exist #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zcattacz opened this issue May 5, 2023 · 2 comments
Open

traceback.format_exc failed due to sys.exc_info not exist #652

zcattacz opened this issue May 5, 2023 · 2 comments

Comments

@zcattacz
Copy link

zcattacz commented May 5, 2023

Is this expected? not design to work on MCU ports ?

>>> try:
...     1/0
... except:
...     print(traceback.format_exc())
...     
...     
... 
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "traceback.py", line 27, in format_exc
AttributeError: 'module' object has no attribute 'exc_info'
@andrewleech
Copy link
Contributor

I'm not sure, I haven't tried the traceback module from here it might be out of date.

Take a look at this, it might be what you want: https://docs.micropython.org/en/latest/library/sys.html#sys.print_exception

@nkrba
Copy link

nkrba commented Sep 25, 2024

Thanks to @andrewleech, the above link worked!

try:
  ...
except Exception as exc:
  print_exception(exc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants