<div dir="ltr"><div>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.<br><br></div>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):<br><div><div><br><div style="margin-left:40px"><span style="font-family:monospace">> ipython               <br>Python 2.7.6<br>IPython 2.2.0 -- An enhanced Interactive Python.<br><br>In [1]: %logstart -o testing_logging.py<br>Activating auto-logging. Current session state plus future input saved.<br>Filename       : testing_logging.py<br>Mode           : backup<br>Output logging : True<br>Raw input log  : False<br>Timestamping   : False<br>State          : active<br><br>In [2]: print 'Hello logging world non-IPython out!'<br>Hello logging world non-IPython out!<br><br>In [3]: 'Hello logging world IPython out!'<br>Out[3]: 'Hello logging world IPython out!'<br><br>In [4]: exit<br></span></div><br>The resulting file looks like:<br><br><div style="margin-left:40px"><span style="font-family:monospace"># IPython log file<br><br>print 'Hello logging world non-IPython out!'<br>'Hello logging world IPython out!'<br>#[Out]# 'Hello logging world IPython out!'<br>exit()<br></span></div><br></div><div>Essentially I'd like the contents of the second input to be recorded as it is for the third.<br></div><div><br></div><div>Before I go hacking around with the magic and sys.stdout, does anybody have a quick solution to this?<br><br></div><div>Thanks,<br><br>Phil<br></div><div><br></div></div></div>