[Tutor] Command Line Editting: How to improve options?

Steven D'Aprano steve at pearwood.info
Thu Apr 2 14:07:51 CEST 2015


On Thu, Apr 02, 2015 at 06:36:03AM +0000, J L wrote:
>  Win 7Python v 3.4.3
> I'm new to Python and only have coursework under my belt in another 
> object oriented programming language as well as limited systems 
> skills. After launching Python from the command line with py.exe, it 
> appears that the interrupter starts up fine. I've read on Python.Org's 
> site in a tutorial section that some interrupters offer command line 
> editing beyond simple use of the arrow keys and backspace. It does not 
> appear that my environment is allowing these greater abilities. How 
> does one afford increased abilities to edit commands within Python's 
> interrupter? Thank you. 


Sadly, Windows does not offer much in the way of powerful interactive 
commands like most Linux shells do. You can try these options:

- try using Python's IDLE:

http://www.google.com.au/search?q=how+to+run+IDLE+python

- Use a commercial third-party IDE ("Integrated Development 
Environment") such as PyCharm, Anaconda or Komodo. Some of them may cost 
money, but they may have free or trial versions.

- Or a third-party editor such as Spyder, if it comes with its own 
interactive shell.

- I can strongly recomment iPython, which is very powerful and includes 
a lot of command-line features that even Linux shells don't:

http://ipython.org/
‎
If you've used Mathematica, you may love iPython's "notepad" feature.

Now we start getting to slightly more complex options, which may not 
work, but it would be interesting to try:

- Try installing pyreadline, and see it is will work with Python 3.4. If 
it does, you might be able to convince Python 3.4's rlcompleter module 
to work with it.

- Still if pyreadline works with Python 3.4, you might like my command 
line tab completer and history module rather than the built-in one:

http://code.google.com/p/tabhistory/source/browse/tabhistory.py

I've never tested it on Windows, so I don't know if it will actually 
work or not.


Good luck!



-- 
Steve


More information about the Tutor mailing list