2

I run OpenElec on a Pi. I can ssh to the Pi and open a python shell.

How do I enable the cursor keys to work like up getting to last command in the python shell, like it does on my Ubuntu box.

Now the cursor key up just shows: >>> ^[[A

migrated from raspberrypi.stackexchange.com Mar 14 '15 at 14:10

This question came from our site for users and developers of hardware and software for Raspberry Pi.

2

OpenElec compiles Python with readline support disabled. Readline is the line edition library that the interactive Python interpreter uses, so without it, cursor keys won't work.

The readline library is present on the system, so you can compile rlwrap (a small wrapper that provides readline command line edition to any command) and run rlwrap python. You'll need to install compilation tools on our Ubuntu PC, then download the source of rlwrap and compile it. Alternatively there may be a suitable ARM binary of rlwrap somwehere.

You can also install rlwrap on your PC and run rlwrap ssh pi python.

  • Thx. Running rlwrap ssh pi python isn't exactly working very well. But I get your drift. I guess Python development is better done in Raspbian on the Pi. And I found some info I was looking for in Pydocs on the Kodi Wiki – Janghou Mar 15 '15 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.