circuitpython: Application exception output to serial (over USB) appears truncated due to buffering issue
My near-perfect code has just spat an exception. I’m running 4.0.0-beta.3-4-g186e31591-dirty
which 4.0.0 beta 3 with a minor tweak. The exception has half-appeared on my console (PuTTY on Windows) from the CPX over USB:
Press any key to enter the REPL. Use CTRL-D to reload.soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Shared couter PWM failure I - trying in reverse order
Shared couter PWM failure II - soft/hard reset suggested
Ready to play
Traceback (most recent call last):
File "code.py", line
There’s a single space after line
- the absence of the rest of the text on the line makes it very apparent it’s truncated. When I press the enter key and the rest appears leaving it looking like this:
Press any key to enter the REPL. Use CTRL-D to reload.soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Shared couter PWM failure I - trying in reverse order
Shared couter PWM failure II - soft/hard reset suggested
Ready to play
Traceback (most recent call last):
File "code.py", line 199, in <module>
TypeError: list indices must be integers, not tuple
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-beta.3-4-g186e31591-dirty on 2019-03-11; Adafruit CircuitPlayground Express with samd21g18
I’ve never noticed that before and I use this setup a lot. It appears fully reproducible for this particular code/error combo. Are there differences in the way 4.0.0 vs previous versions writes to serial or how it reports exceptions?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 39 (14 by maintainers)
Hi,
Express with no errors. Thanks!
On Fri, Apr 17, 2020 at 4:36 AM Ha Thach notifications@github.com wrote:
4.x uses a different USB stack than 3.x so it’s likely a bug in TinyUSB. Maybe @hathach will take a look.
@hathach I’m starting to look at ESP32-S2 today again and will likely do the TinyUSB update as part of that.
I could reproduce the issue with detail instruction from @DavePutz, will try to troubleshoot it and post update here.
If this only affects serial writes then I would say it’s not overly important to address quickly.
I find it easy to reproduce on REPL and if there’s a good way to debug a board where you can see what function is being used that would give away what’s going on. For REPL if you keep trying to reproduce it then the frequency of occurrence dramatically drops, it’s almost as if it goes into hiding!