Page 1 of 1

Help getting REPL prompt in screen

Posted: Fri May 16, 2014 11:48 am
by chris
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

Re: Help getting REPL prompt in screen

Posted: Fri May 16, 2014 12:14 pm
by fma
Do you have a script running (uploaded through mass storage device, or on sd card)?

Re: Help getting REPL prompt in screen

Posted: Fri May 16, 2014 12:35 pm
by chris
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 :-)

Re: Help getting REPL prompt in screen

Posted: Fri May 16, 2014 12:46 pm
by fma
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!

Re: Help getting REPL prompt in screen

Posted: Fri May 16, 2014 2:13 pm
by dhylands
You should also be able to use Control-C to stop the running program and be dropped to the REPL prompt.

Re: Help getting REPL prompt in screen

Posted: Fri May 16, 2014 2:24 pm
by fma
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?

Re: Help getting REPL prompt in screen

Posted: Fri May 16, 2014 2:36 pm
by dhylands
I thought that the serial line was created before the script runs, and that handling the characters was all interrupt based.