← index #6912Issue #4196
Related · high · value 2.590
QUERY · ISSUE

Raw paste mode can't be used with WebREPL

openby aivarannamaaopened 2021-02-16updated 2025-08-26
bugunicode

Thonny users found that after upgrading MicroPython on their ESP8266 from 1.13 to 1.14, the WebREPL connection didn't work anymore (https://github.com/thonny/thonny/issues/1613).

Thonny first tries to communicate with the device in raw-paste mode, but this fails at websocket level when the device actually supports this mode. It looks like WebREPL is sending the window size increment as a text frame and this can produce a UnicodeDecodeError. Example stacktrace when using ESP8266:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 827, in transfer_data
    message = await self.read_message()
  File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 910, in read_message
    return frame.data.decode("utf-8") if text else frame.data
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

I didn't check the actual content and type of the websocket frames, but I've seen 0x80 as part of the window-size increment bytes before.

For now, I'm going to use regular paste mode with WebREPL connection, but it would be nice, if the more efficient raw-paste mode worked as well.

CANDIDATE · ISSUE

BUG -- initial prompt on WebREPL connect is always ">>> ", even for paste (and raw) mode

openby Hermann-SWopened 2018-09-28updated 2018-09-28

If bringing MicroPython into paste mode and disconnecting then, initial prompt on next WebREPL connect is wrong. The prompt is ">>> " although MicroPython is in paste mode as can be seen in screenshot. Initial prompt on connect is wrong as well if the module gets into raw mode (eg. by screen session). Initial prompt on WebREPL connect then is ">>> " as well.

Since MicroPython should know its mode on connect, it should present the correct initial prompt:
<img src="https://stamm-wilbrandt.de/en/forum/webrepl.initial_prompt.wrong.png"/>

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