470,810 Members | 861 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

saving interpreter source?

Hello, I would like to be able to save source typed into the interpreter
to a file. Kind of like marshal, but I would like to have the file contain
the source so I can edit it later. Something like inspect.getsource() but
for source typed into the interpreter, not imported from a module. Is this
possible? Any ideas are greatly appreciated. -Garett
Jul 18 '05 #1
5 1492
Garett wrote:
Hello, I would like to be able to save source typed into the interpreter
to a file. Kind of like marshal, but I would like to have the file contain
the source so I can edit it later. Something like inspect.getsource() but
for source typed into the interpreter, not imported from a module. Is this
possible? Any ideas are greatly appreciated. -Garett


Last time I used it, Chris Gonnerman's readline replacement kept a
history by default:

http://newcenturycomputers.net/projects/readline.html

-Peter
Jul 18 '05 #2
Peter Hansen wrote:
Garett wrote:
Hello, I would like to be able to save source typed into the
interpreter to a file. Kind of like marshal, but I would like to
have the file contain the source so I can edit it later.
Something like inspect.getsource() but for source typed into the
interpreter, not imported from a module. Is this possible? Any
ideas are greatly appreciated. -Garett


Last time I used it, Chris Gonnerman's readline replacement kept a
history by default:

http://newcenturycomputers.net/projects/readline.html


Also, take a look at the following. It tells you how to configure
your interactive sessions so that both (1) interactive history
will be saved to a file and (2) that history will be available in
subsequent interactive sessions.

Dave

--
http://www.rexx.com/~dkuhlman

Jul 18 '05 #3
Dave Kuhlman wrote:
Peter Hansen wrote:
Garett wrote:
Hello, I would like to be able to save source typed into the
interpreter to a file. Kind of like marshal, but I would like to
have the file contain the source so I can edit it later.
Something like inspect.getsource() but for source typed into the
interpreter, not imported from a module. Is this possible? Any
ideas are greatly appreciated. -Garett


Last time I used it, Chris Gonnerman's readline replacement kept
a history by default:

http://newcenturycomputers.net/projects/readline.html


Also, take a look at the following. It tells you how to configure
your interactive sessions so that both (1) interactive history
will be saved to a file and (2) that history will be available in
subsequent interactive sessions.


Oops. Forgot the link. Here it is:

http://docs.python.org/lib/readline-example.html

Dave

--
http://www.rexx.com/~dkuhlman
Jul 18 '05 #4
Garett wrote:
Hello, I would like to be able to save source typed into the interpreter
to a file. Kind of like marshal, but I would like to have the file contain
the source so I can edit it later. Something like inspect.getsource() but
for source typed into the interpreter, not imported from a module. Is this
possible? Any ideas are greatly appreciated. -Garett


Skip has once written something like that:

http://manatee.mojam.com/~skip/python/save_session.py

It won't work on Windows, however.

Gerrit.

--
Weather in Twenthe, Netherlands 22/04 10:25:
15.0°C Few clouds mostly cloudy wind 1.3 m/s SW (57 m above NAP)
--
Experiences with Asperger's Syndrome:
EN http://topjaklont.student.utwente.nl/english/
NL http://topjaklont.student.utwente.nl/

Jul 18 '05 #5
On Wed, 21 Apr 2004 10:36:48 -0600, Garett <as**@asdf.asdf> wrote:
Hello, I would like to be able to save source typed into the interpreter
to a file. Kind of like marshal, but I would like to have the file contain
the source so I can edit it later. Something like inspect.getsource() but
for source typed into the interpreter, not imported from a module. Is this
possible? Any ideas are greatly appreciated. -Garett


Look into IPython. It's "An enhanced Interactive Python shell", and
includes a "save" command, where you can even specify which lines you
want saved. http://ipython.scipy.org/
--dang
Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by a9605473 | last post: by
16 posts views Thread by Neil Benn | last post: by
12 posts views Thread by Anon | last post: by
5 posts views Thread by Leo | last post: by
6 posts views Thread by gr | last post: by
5 posts views Thread by Joel | last post: by
10 posts views Thread by Janto Dreijer | last post: by
40 posts views Thread by castironpi | last post: by
reply views Thread by Robert Kern | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.