saving interpreter source?

Discussion in 'Python' started by Garett, Apr 21, 2004.

  1. Garett

    Garett Guest

    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
     
    Garett, Apr 21, 2004
    #1
    1. Advertising

  2. Garett

    Peter Hansen Guest

    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
     
    Peter Hansen, Apr 21, 2004
    #2
    1. Advertising

  3. Garett

    Dave Kuhlman Guest

    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
     
    Dave Kuhlman, Apr 21, 2004
    #3
  4. Garett

    Dave Kuhlman Guest

    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
     
    Dave Kuhlman, Apr 22, 2004
    #4
  5. Garett

    Gerrit Guest

    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/
     
    Gerrit, Apr 22, 2004
    #5
  6. On Wed, 21 Apr 2004 10:36:48 -0600, 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


    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
     
    Daniel 'Dang' Griffith, Apr 26, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Kandell
    Replies:
    4
    Views:
    4,188
    eeebop
    Dec 10, 2004
  2. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,536
    Luis Esteban Valencia
    Jan 6, 2005
  3. Replies:
    3
    Views:
    775
    Ziga Seilnacht
    Jan 3, 2007
  4. mattc
    Replies:
    1
    Views:
    273
    Terry Reedy
    Jan 29, 2009
  5. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    220
    Curt_C [MVP]
    Oct 3, 2003
Loading...

Share This Page