← index #652Issue #628
Off-topic · high · value 0.816
QUERY · ISSUE

traceback.format_exc failed due to sys.exc_info not exist

openby zcattaczopened 2023-05-05updated 2024-09-25

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'
2 comments
andrewleech · 2023-05-05

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 · 2024-09-25

Thanks to @andrewleech, the above link worked!

try:
  ...
except Exception as exc:
  print_exception(exc)
CANDIDATE · ISSUE

STM Servo and UART 3 Issue

closedby RakshakTalwaropened 2014-05-26updated 2016-09-03

On the STM32F4DISCOVERY the Servo module doesn't exist.
Also, UART 3 is behaving as if there's no data in. I did get UART 6 to work without any problems.

>>> pyb.Servo(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Servo'
>>> a = pyb.UART(3)
>>> a.init(9600)
>>> a.recv(12)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Exception: HAL_UART_Receive failed with code 3

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied