Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question

migrated from raspberrypi.stackexchange.com 2 days ago

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

1 Answer 1

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.

share|improve this answer
    
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 yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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