Closed
Description
Run this script:
from microbit import *
display.scroll('Takes a while')
raise ValueError(123)
Press Ctrl-C during the scrolling text.
Unexpectedly you see the error message from the ValueError scrolled on the micro:bit.
If the raise line is replaced with print("Here") then the print output doesn't show.
If the scroll is replaced by a sleep then the ValueError does not show.
This behaviour is a bit awkward for the simulator as our stop button sends a Ctrl-C to interrupt the program, but given this behaviour it can be 10s of seconds before it actually stops.
The original code example was more realistic with the ValueError thrown by micro:bit MicroPython API parameter validation.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
dpgeorge commentedon Sep 27, 2022
Thanks for the report. This is a strange bug!
The following should fix it, but I need to test it more before merging this fix:
microbit-matt-hillsdon commentedon Oct 10, 2022
@microbit-robert to try this out and update the issue.
microbit-robert commentedon Oct 10, 2022
The suggested change above works well and fixes the issue described.
codal_port/drv_display: Raise any pending exc's if animation stopped.
dpgeorge commentedon Oct 24, 2022
I tested this and checked that all callers of this function can accept it raising an exception.
Implemented in cfe75b2