WebREPL Connection lost (EOF) in Thonny 3.3.3 ESP8266 MicroPython v.1.14
See original GitHub issueI am using ESP8266 running the latest MicroPython v1.14. I have configured WebREPL with a password and can connect to it with the “official” WebREPL client for MicroPython (webrepl.html). The same does not work in Thonny, I have the following messages, trying to connect, then Stop/Restart backend couple of times as suggested by the first error message, also tried to turn on/off ESP8266 and restart Thonny:
MicroPython v1.14 on 2021-02-02; ESP module with ESP8266
Type "help()" for more information.
>>>
-----------------------------------------------------------------------------------------------------------
WebREPL connected
Connection lost (EOF)
Use Stop/Restart to reconnect.
-----------------------------------------------------------------------------------------------------------
Exception in thread Thread-2:
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
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\Thonny\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Program Files (x86)\Thonny\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\webrepl_connection.py", line 54, in _wrap_ws_main
loop.run_until_complete(self._ws_main())
File "C:\Program Files (x86)\Thonny\lib\asyncio\base_events.py", line 587, in run_until_complete
return future.result()
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\webrepl_connection.py", line 66, in _ws_main
await asyncio.gather(self._ws_keep_reading(), self._ws_keep_writing())
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\webrepl_connection.py", line 123, in _ws_keep_writing
await self._ws.send(payload)
File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 555, in send
await self.ensure_open()
File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 812, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
-----------------------------------------------------------------------------------------------------------------
Exception in thread Thread-2:
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
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\Thonny\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Program Files (x86)\Thonny\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\webrepl_connection.py", line 54, in _wrap_ws_main
loop.run_until_complete(self._ws_main())
File "C:\Program Files (x86)\Thonny\lib\asyncio\base_events.py", line 587, in run_until_complete
return future.result()
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\webrepl_connection.py", line 66, in _ws_main
await asyncio.gather(self._ws_keep_reading(), self._ws_keep_writing())
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\webrepl_connection.py", line 123, in _ws_keep_writing
await self._ws.send(payload)
File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 555, in send
await self.ensure_open()
File "C:\Program Files (x86)\Thonny\lib\site-packages\websockets\protocol.py", line 812, in ensure_open
raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
-----------------------------------------------------------------------------------------------------------------
My environment: Windows 10 Home, Thonny 3.3.3, Python 3.7.9 (32 bit) Tk 8.6.9 COM6 connection in Thonny works as expected, I can connect to ESP8266, run Python code and upload files, but I would like to use WebREPL if possible.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
webrepl problem - MicroPython Forum (Archive)
Hello, im trying to setup webrepl on my bord, loin32 boot.py ... STA_IF) if not sta_if.isconnected(): print('connecting to network.
Read more >Wireless MicroPython Programming With Thonny - Hackaday
For Linux and Mac simply doing sudo apt install thonny or brew install ... Fill in the WebREPL URL and password — you...
Read more >how do I read a file in desktop on esp8266 micropython?
I using the mac os and thonny micropython ide. the file is called graph.txt on the desktop. when i try reading it from...
Read more >MicroPython ESP32 pro-tip: Use WebREPL within Thonny
We've learned how to wirelessly connect and upload new code to an ESP32 using WebREPL before. But often, the repetitive process of: editing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Verified that Thonny 3.3.4 can open MicroPython v.1.14 WebRepl (ESP8266).
It appears that Thonny 3.3.4 + MicroPython 1.14 are still having problems when a remote WebREPL connects:
I see this issue is now closed, so maybe I’ll start a new thread. I was kinda thinking these issues were probably somewhat related.