Replay commands
David Porter
jcm at bigskytel.com
Thu Dec 21 02:36:38 EST 2000
* pinhong at eecs.berkeley.edu <pinhong at eecs.berkeley.edu>:
> When using Python interactively, I need to save my command history
> for editing and reuse. Is that possible?
Yes.
An example of it being done can be found in IPP, the Interactive Python
Prompt at <~ > mc
~ > locate PythonInterpreter
~ > locate PythonPrompt
~ > locate interpreter
/suse/usr/doc/packages/python/html/lib/interpreter-objects.html
/usr/lib/gaby/plug-ins/interpreter
/usr/lib/gaby/plug-ins/interpreter/libpython.la
/usr/lib/gaby/plug-ins/interpreter/libpython.so
/usr/lib/gaby/plug-ins/interpreter/libpython.so.0
/usr/lib/gaby/plug-ins/interpreter/libpython.so.0.0.0
/usr/share/doc/gaby/C/interpreters.html
/usr/share/doc/gaby/README.plug-ins_interpreter_python
/var/www/python/html/lib/interpreter-objects.html
/win/Python20/Doc/lib/interpreter-objects.html
/win/Python20/Doc/mac/interpreter.html
~ > mc
~ >
~ >
~ >
~ > mc
You have mail in /var/spool/mail/dap
~ > pyrun ipp
Reading /home/dap/.pyrun.gz
Building script list.
Rebuilding /home/dap/.pyrun.gz
Building file list... this can take a while.
Reading /home/dap/.pyrun.gz
Building script list.
Script found at /home/dap/py/ipp/ipp.py
Executing.
Python 1.5.2 (#0, Apr 3 2000, 14:46:48) [GCC 2.95.2 20000313 (Debian
GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
(IPP)
Type ? for more help
>>> ?
ipp -> the interactive python prompt
An enhanced console for Python.
Features are:
- readline support if present
- completion in the local namespace, eg. type TAB twice at the prompt.
- logging of input , see command-line options
- Systemshell escape by the ! , eg !ls
- Pythonshell commands, starting with a @
- some of these are @ls, @pwd, @cd
- Keeps track of locally defined variables @who, @whos
- Show documentation with a ? , eg ?list
- evaluation of a personal config file which can be used to extend
the shell
- expansion of history lines by a starting '.'
Command line options:
-i | execute remaining files and than jump to the prompt
-l | logging in standard-log file
-L file | name a special log file and log into it
-s | don't read $HOME/.ipprc
-c file | read this as ipprc
>>>
~ > pyrun ipp -l
Reading /home/dap/.pyrun.gz
Building script list.
Script found at /home/dap/py/ipp/ipp.py
Executing.
Python 1.5.2 (#0, Apr 3 2000, 14:46:48) [GCC 2.95.2 20000313 (Debian
GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
(IPP)
Type ? for more help
>>>
~ > pyrun ipp -L pylog
Reading /home/dap/.pyrun.gz
Building script list.
Script found at /home/dap/py/ipp/ipp.py
Executing.
Python 1.5.2 (#0, Apr 3 2000, 14:46:48) [GCC 2.95.2 20000313 (Debian
GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
(IPP)
Type ? for more help
>>> agd
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: agd
>>> reg
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: reg
>>> hg
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: hg
>>> trgh
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: trgh
>>> th
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: th
>>> gre
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: gre
>>> re
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: re
>>> 45yt
File "<console>", line 1
45yt
^
SyntaxError: invalid syntax
>>>
>>> htr
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: htr
>>> ht
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: ht
>>> ht
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: ht
>>> gr
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: gr
>>> rg
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: rg
>>> rge
Traceback (innermost last):
File "<console>", line 1, in ?
NameError: rge
>>>
~ > less py
py pylog pyrun
~ > less pylog
F10 key ==> File Edit Search Buffers Windows System Help
* pinhong at eecs.berkeley.edu <pinhong at eecs.berkeley.edu>:
> When using Python interactively, I need to save my command history
> for editing and reuse. Is that possible?
Yes.
An example of it being done can be found in IPP, the Interactive Python
Prompt at <http://starship.python.net/crew/jhauser/miscellany.html>.
David
More information about the Python-list
mailing list