How to record the console's content in the interpreter?

Manfred Lotz ml_news at posteo.de
Fri Aug 23 06:07:29 EDT 2019


On Fri, 23 Aug 2019 00:42:26 -0700 (PDT)
jfong at ms4.hinet.net wrote:

> Manfred Lotz於 2019年8月23日星期五 UTC+8下午2時58分48秒寫道:
> > On Thu, 22 Aug 2019 21:48:33 -0700 (PDT)
> > jfong at ms4.hinet.net wrote:
> >   
> > > Cameron Simpson於 2019年8月23日星期五
> > > UTC+8下午12時09分54秒寫道:  
> > > > On 22Aug2019 19:38, Jach Fong <jfong at ms4.hinet.net> wrote:    
> > > > >Say I like to record everything showing in the console into a
> > > > >file after I start a debug session, and stop it when finished.
> > > > >It's not a console redirection. I still need to see what is
> > > > >going on during the session.    
> > > > 
> > > > If you're in a terminal you can run the 'script" command. This
> > > > starts a new shell inside a session which records itself to the
> > > > file "typescript" (by default). See "man script" for further
> > > > details.
> > > > 
> > > > Cheers,
> > > > Cameron Simpson <cs at cskk.id.au>    
> > > 
> > > Mine is Windows:-( No 'script' command?
> > > 
> > > --Jach  
> > 
> > If I understand you correctly you want to save an interactive
> > session!?
> > 
> > Then you could use ipython. In ipython the lines get numbererd. If
> > your last line is, for example: In [100] you could do this:
> > 
> > save mysave 1-100
> > 
> > in the ipython shell.
> > 
> > -- 
> > Manfred  
> 
> After a quick try on IPython 6.5.0, I saw only the commands I had
> typed, not include the output of those commands:-(
> 

Sorry, that's true.

I found only this. After starting ipython type:

%logstart -o

Then you get also command output. The log file name is: ipython_log.py

But it doesn't seem to show output from print command.


-- 
Manfred






More information about the Python-list mailing list