'ampy run' does not print to output in realtime

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
Posts: 12
Joined: Sat Feb 02, 2019 8:32 am

'ampy run' does not print to output in realtime

Post by eltomek » Mon Jan 20, 2020 9:41 pm

Using Ubuntu Linux, I can successfully manipulate my esp32 board with adafruit-ampy but when I 'ampy run file.py' I can see no output on my console. The code executes on the device but the Linux console is pretty idle by the time the code breaks, only then some of the content I'd expect to see in realtime is printed on STDOUT.
This must be some Linux IO setting, any idea?

Cheers, /e

User avatar
Posts: 3484
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: 'ampy run' does not print to output in realtime

Post by dhylands » Tue Jan 21, 2020 7:30 am

Linux supports 3 buffering modes. Unbuffered, line buffered, and fully. IIRC stderr is line buffered and stdout is fully buffered. Fully buffered typically collects 4-8K off data before outputting. You can call flush() to force data to be written.

Post Reply