Page 1 of 1

WARNING:root:Unexpected echo

Posted: Thu Jun 10, 2021 10:46 am
by james_saunders2
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, ())

Re: WARNING:root:Unexpected echo

Posted: Thu Jun 10, 2021 12:48 pm
by hippy
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'.

Re: WARNING:root:Unexpected echo

Posted: Thu Jun 10, 2021 3:04 pm
by james_saunders2
Thank you! Will avoid threading in the future

Re: WARNING:root:Unexpected echo

Posted: Thu Jun 10, 2021 6:29 pm
by aivarannamaa
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.