Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
IPython startup script which configures IPython to log all input/output and does so *without cluttering the prompt* when starting IPython
from time import strftime
import os.path
import contextlib
import cStringIO
import sys
# create a context which we can use for any block which we can use for any
# block which we do not want to print stdout
# -- taken from http://stackoverflow.com/a/2829036/217652
@contextlib.contextmanager
def nostdout():
save_stdout = sys.stdout
sys.stdout = cStringIO.StringIO()
yield
sys.stdout = save_stdout
ip = get_ipython()
ldir = ip.profile_dir.log_dir
fname = strftime('%Y-%m-%d-%H-%M-%S') + ".py"
filename = os.path.join(ldir, fname)
# stdout is now muted
with nostdout():
ip.run_line_magic('logstart', '-o %s append' % filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.