[IPython-dev] Logging commands using the %logstart magic

Wes Turner wes.turner at gmail.com
Tue Nov 18 02:28:37 EST 2014


IPython notebook format docs:


IPython notebook nbformat v4 JSONSchema:
> https://github.com/minrk/ipython/blob/nbformat4/IPython/nbformat/v4/nbformat.v4.schema.json
> Metadata Documentation:
> https://github.com/minrk/ipython/blob/nbformat4/docs/source/notebook/nbformat.rst#metadata
> JSON-LD JSONSchema:
> https://github.com/json-ld/json-ld.org/blob/master/schemas/jsonld-schema.json


( https://youtrack.jetbrains.com/issue/PY-14326 )

On Mon, Nov 17, 2014 at 10:47 AM, Phil Elson <pelson.pub at gmail.com> wrote:

> I'm trying to replicate functionality found in IDL which generates
> something called "journal" files. Journal files in IDL are essentially a
> log of commands alongside the (commented out) output and themselves produce
> valid code.
>
> IPython's %logstart with the "-o" flag is almost exactly what I need,
> except it doesn't seem to record standard out (only IPython out):
>
> > ipython
> Python 2.7.6
> IPython 2.2.0 -- An enhanced Interactive Python.
>
> In [1]: %logstart -o testing_logging.py
> Activating auto-logging. Current session state plus future input saved.
> Filename       : testing_logging.py
> Mode           : backup
> Output logging : True
> Raw input log  : False
> Timestamping   : False
> State          : active
>
> In [2]: print 'Hello logging world non-IPython out!'
> Hello logging world non-IPython out!
>
> In [3]: 'Hello logging world IPython out!'
> Out[3]: 'Hello logging world IPython out!'
>
> In [4]: exit
>
> The resulting file looks like:
>
> # IPython log file
>
> print 'Hello logging world non-IPython out!'
> 'Hello logging world IPython out!'
> #[Out]# 'Hello logging world IPython out!'
> exit()
>
> Essentially I'd like the contents of the second input to be recorded as it
> is for the third.
>
> Before I go hacking around with the magic and sys.stdout, does anybody
> have a quick solution to this?
>
> Thanks,
>
> Phil
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>


-- 
Wes Turner
https://westurner.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141118/071f86bb/attachment.html>


More information about the IPython-dev mailing list