Unexpected behaviour of REPL prompt

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Unexpected behaviour of REPL prompt

Post by Roberthh » Fri Jul 24, 2015 4:26 pm

By chance I determined an bahviour of the REPL prompt, which differs from standard python.
If at the >>> prompt I enter:
print ("[2J")
I get the REPL continuation prompt:
...
until I press Ctrl-D, which the prints the expected string [2J. I do not know whether this is intentional, but it's different.
Placing the print statement in a script works as expected.

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Unexpected behaviour of REPL prompt

Post by blmorris » Fri Jul 24, 2015 6:51 pm

This appears to be related to an issue that was reported on GitHub a few days ago:

https://github.com/micropython/micropython/issues/1387

It can't hurt to report if you are having a problem with as well.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Unexpected behaviour of REPL prompt

Post by Roberthh » Thu Aug 06, 2015 8:14 am

Thanks for fixing that
Robert

Gordon_Hardman
Posts: 68
Joined: Sat May 03, 2014 11:31 pm

Re: Unexpected behaviour of REPL prompt

Post by Gordon_Hardman » Sat Aug 22, 2015 6:13 pm

I noticed that behavior too. It looks like you were trying to send escape codes... This is what I ended up with:
print("\x1B\x5B2J", end="") #VT100 clear screen
print("\x1B\x5BH", end="") #VT100 upper left corner
It clears the screen and puts the cursor in the upper left corner, if your terminal program responds to to VT100 escape codes. It "repaints' from there down, which is frequently a lot nicer than having stuff scrolling off the screen!

Post Reply