History substitution on dos

Alex Martelli aleaxit at yahoo.com
Thu Jun 14 05:56:58 EDT 2001


"Brian Elmegaard" <brian at rk-speed-rugby.dk> wrote in message
news:3B285D25.3D9B9851 at rk-speed-rugby.dk...
> Hi,
>
> (I think) I have been through the faq, but I can't find out how to make
> use of the command history when running python interactively from a
> dos-prompt. Can it be used?

It depends on your OS, how Python was built, and the
optional modules you may have installed.

Given that you mention a "dos-prompt" I'll assume you
are in some version of Windows rather than Unix or Mac or...

On NT and 2000 (using cmd.exe), it just works with
any Python -- being halfway-decent operating systems
(albeit not wartless:-), NT and 2000 supply a minute
but useful amount of help to interactive text-mode
programs like python.exe:-).  I suspect Windows/XP
will be similar, since it stems from /NT roots.

On /95, /98 and /ME, using command.com, the OS does
not help (one might say, it hinders).  Those sorry
excuses for an imitation of an OS have this among
their uncountedly many other warts.  Alas, sometimes
you still HAVE to use one of them (e.g., my nifty
new ultralight laptop only has sleep/freeze/and other
typically laptopish powersaving features under /98 --
no support for either /2000, /XP, Linux, BSD, etc
etc -- so I'm stuck with /98 there, *URGH*).

Fortunately, there *IS* still (a glimmer of) hope!-)
Cygwin (making it all look almost as good as Unix)
is one possibility.  If you DO have to work within
command.com for some reason, *all is not lost yet*!

http://newcenturycomputers.net/projects/readline.html
is where Chris Gonnerman has placed this lifesaver
for us poor lost souls.  Simplest is just to download
(a single-line long URL, it's probably going to be
split by some software or other, beware!-):
http://newcenturycomputers.net/cgi-bin/download.py/projects/downloads/Readli
ne-1.4.win32-py2.1.exe
run this self-installing executable, and be happy.

There is also a version for Python 2.0, with an
identical url except py2.1 is replaced with py2.0
towards the end.
Or, get the full source+prebuilt-binaries archive at
http://newcenturycomputers.net/cgi-bin/download.py/projects/downloads/Readli
ne-1.4b.zip
it includes a distutils setup.py so your life is
easy anyway on any Python >= 2.0.  If you have an
older Python you can still get distutils for it, I
think, but I have no experience in the matter.


Alex






More information about the Python-list mailing list