WARNING:root:Unexpected echo

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
james_saunders2
Posts: 5
Joined: Wed Jun 09, 2021 1:14 pm

WARNING:root:Unexpected echo

Post by james_saunders2 » Thu Jun 10, 2021 10:46 am

Not sure what's happened, I received this error in the shell and am now receiving the same error every time I attempt to run any programme, even programmes that I know work.

Code: Select all

WARNING:root:Unexpected echo. Expected b'%Run -c $EDITOR_CONTENT\r\n', got b'You pressed the button!\r\n'
It came after trying to run this:

Code: Select all

import machine
from machine import Pin
import utime
import _thread
button = machine.Pin(9, machine.Pin.IN, machine.Pin.PULL_DOWN)
global pressed
pressed = False
def button_thread():
    global pressed
    while True:
        if button.value() == 1:
            pressed = True
            print("You pressed the button!")
        utime.sleep(0.01)
        
_thread.start_new_thread(button_thread, ())

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: WARNING:root:Unexpected echo

Post by hippy » Thu Jun 10, 2021 12:48 pm

james_saunders2 wrote:
Thu Jun 10, 2021 10:46 am
Not sure what's happened,
You used threading and Thonny; that's inviting a nightmare upon yourself.

To fix things, simply unplug the Pico and start again, perhaps close and restart Thonny.

If you have saved your code as 'main.py' keep hitting Ctrl-C, clicking the Stop/Reatrt Backend icon, unil you are able to save a different 'main.py'.

james_saunders2
Posts: 5
Joined: Wed Jun 09, 2021 1:14 pm

Re: WARNING:root:Unexpected echo

Post by james_saunders2 » Thu Jun 10, 2021 3:04 pm

Thank you! Will avoid threading in the future

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: WARNING:root:Unexpected echo

Post by aivarannamaa » Thu Jun 10, 2021 6:29 pm

The source of the problem lies here: https://github.com/micropython/micropython/issues/6899

Thonny makes it visible, because it needs reliable feedback for its commands.
Aivar Annamaa
https://thonny.org

Post Reply