jupyter_micropython_kernel
jupyter_micropython_kernel copied to clipboard
Get esptool output to stream
Running this from command line:
esptool.py --port /dev/ttyUSB4 erase_flash
gives
esptool.py v2.0 Connecting.... Detecting chip type... ESP32 Chip is ESP32D0WDQ6 (revision 1) Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)...
Whereas in Python,
import subprocess
process = subprocess.Popen("esptool.py --port /dev/ttyUSB4 erase_flash".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in process.stdout:
print([line])
hangs on the second line until you pull the USB cable out. It's as if esptool is not calling flush() on the buffers, but the command line case is able to pull the bytes out anyway.
Possibly the holdup is not pressing the PRG button when you should. I have inserted a message into the flow of output that prints when it gets to the "Connecting...." line