Help getting REPL prompt in screen

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
chris
Posts: 4
Joined: Wed May 07, 2014 5:56 pm

Help getting REPL prompt in screen

Post by chris » Fri May 16, 2014 11:48 am

I have been following the tutorial on the REPL prompt and can't get the prompt to appear.

On a Mac I have run screen /dev/tty.usbmodem* and this executes correctly but just gives me a totally blank window box. Whatever I do (pressing enter etc) I can't seem to get a Micro Python prompt >>> to type in anything. I have reread the manual (man screen) multiple times with no joy. The board is definitely connected and if I type CTRL-A CTRL-\ it disconnects successfully with the message [screen is terminating]. I tried sudo screen /dev/tty.usbmodem* as well but with the same result.

I also tried with a Raspberry Pi running Raspbian. Again screen /dev/ttyACM0 executes but again gives a blank box. It will disconnect correctly but I fail to get a prompt.

Could someone please advise what I am doing wrong in screen ? I am sure it is something basic! Thank you

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Help getting REPL prompt in screen

Post by fma » Fri May 16, 2014 12:14 pm

Do you have a script running (uploaded through mass storage device, or on sd card)?
Frédéric

chris
Posts: 4
Joined: Wed May 07, 2014 5:56 pm

Re: Help getting REPL prompt in screen

Post by chris » Fri May 16, 2014 12:35 pm

Thank you Frédéric! Yes I did have a script running. Have cleared this and now I can connect to screen and get the prompt. I knew I must have being doing something stupid!

Damien - you may want to put a comment on the tutorial for the REPL page to say make sure you are not running a script and have a blank main.py file before running screen for those like me :-)

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Help getting REPL prompt in screen

Post by fma » Fri May 16, 2014 12:46 pm

In fact, I just saw that you can get the prompt if you connect right after a reset (during a few second, it is possible).

Doing this, the script does not start. If you press CTRL-D, you get a soft reset, keeping the connection open, and so you can see errors and all print() from your script. Very usefull to debug things!
Frédéric

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Help getting REPL prompt in screen

Post by dhylands » Fri May 16, 2014 2:13 pm

You should also be able to use Control-C to stop the running program and be dropped to the REPL prompt.

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Help getting REPL prompt in screen

Post by fma » Fri May 16, 2014 2:24 pm

Ok, but as long as you was able to connect... If you try while the script is running, you can't even connect (the serial line is not created). Am I right? Or did I miss something too?
Frédéric

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Help getting REPL prompt in screen

Post by dhylands » Fri May 16, 2014 2:36 pm

I thought that the serial line was created before the script runs, and that handling the characters was all interrupt based.

Post Reply