¿Hay alguna manera de hacer que la capacidad de registro de IPython incluya salida y entrada?¿Log de la salida de IPython?
Esto es lo que un archivo de registro se parece actualmente:
#!/usr/bin/env python
# 2012-08-06.py
# IPython automatic logging file
# 12:02
# =================================
print "test"
Me gustaría tener una línea más arriba muestran:
#!/usr/bin/env python
# 2012-08-06.py
# IPython automatic logging file
# 12:02
# =================================
print "test"
# test
(el #
es porque supongo que se necesita para evitar que se rompa la función logplay
de IPython)
Supongo que esto es posible usando portátiles IPython, pero al menos en una máquina lo necesito, soy límite ed a ipython 0.10.2.
EDIT: Me gustaría saber cómo hacer esto de forma automática, es decir, dentro del archivo de configuración. Ahora mismo mi config parece
from time import strftime
import os
logfilename = strftime('ipython_log_%Y-%m-%d')+".py"
logfilepath = "%s/%s" % (os.getcwd(),logfilename)
file_handle = open(logfilepath,'a')
file_handle.write('########################################################\n')
out_str = '# Started Logging At: '+ strftime('%Y-%m-%d %H:%M:%S\n')
file_handle.write(out_str)
file_handle.write('########################################################\n')
file_handle.close()
c.TerminalInteractiveShell.logappend = logfilepath
c.TerminalInteractiveShell.logstart = True
pero especificando c.TerminalInteractiveShell.log_output = True
parece tener ningún efecto
La solución parece estar haciendo esto en un script de inicio, como se describe aquí: http://wiki.ipython.org/Cookbook/DatedLog (esta era la solución aportada en http://stackoverflow.com/questions/11836612/where-how-in-what-context-is-ipythons-configuration-file-executed? lq = 1) – keflavich