issue in replaying logs with profile
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
I am using a very recent bazaar build of ipython and python 2.5. I have the following profile in my IPYTHONDIR:
[cohen@jarrett ~]$ more .ipython/
import IPython.ipapi
ip = IPython.ipapi.get()
ip.ex("print '******
ip.ex("print '* TEST *'")
ip.ex("print '******
ip.ex("import os")
I then run the following :
[cohen@jarrett ~]$ ipython -profile test -log
Activating auto-logging. Current session state plus future input saved.
Filename : ipython_log.py
Mode : rotate
Output logging : False
Raw input log : False
Timestamping : False
State : active
*******
* TEST *
*******
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
IPython profile: test
In [1]: n=5.2
In [2]: os
Out[2]: <module 'os' from '/usr/lib/
after exiting the session, the log looks like :
[cohen@jarrett ~]$ more ipython_log.py
#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
#log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
#log# opts = Struct(
#log# args = []
#log# It is safe to make manual edits below here.
#log#--
n=5.2
os
That does *not* look good because the 'profile' value is blank, and indeed :
[cohen@jarrett ~]$ ipython -logplay ipython_log.py
Activating auto-logging. Current session state plus future input saved.
Filename : ipython_log.py
Mode : append
Output logging : False
Raw input log : False
Timestamping : False
State : active
Replaying log...
Loading log file <ipython_log.py> one line at a time...
Finished replaying log file <ipython_log.py>
The following lines/blocks in file <ipython_log.py> reported errors:
os
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: os
-------
NameError Traceback (most recent call last)
/home/cohen/
NameError: name 'os' is not defined
There was no 'TEST' banner and no importing of os, as anticipated as the profile is not filled in the log.
Even more problematic :
[cohen@jarrett ~]$ ipython -profile test -logplay ipython_log.py
Activating auto-logging. Current session state plus future input saved.
Filename : ipython_log.py
Mode : append
Output logging : False
Raw input log : False
Timestamping : False
State : active
Replaying log...
Loading log file <ipython_log.py> one line at a time...
Finished replaying log file <ipython_log.py>
The following lines/blocks in file <ipython_log.py> reported errors:
os
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
Here the -profile argument request is not even honored....
If I add test as the profile in the log file, then I get
the correct behavior in both cases :
[cohen@jarrett ~]$ ipython -logplay ipython_log.py
Activating auto-logging. Current session state plus future input saved.
Filename : ipython_log.py
Mode : append
Output logging : False
Raw input log : False
Timestamping : False
State : active
*******
* TEST *
*******
Replaying log...
Loading log file <ipython_log.py> one line at a time...
Finished replaying log file <ipython_log.py>
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
IPython profile: test
In [1]: os
Out[1]: <module 'os' from '/usr/lib/
In [2]: n
Out[2]: 5.2000000000000002
In [3]:
Do you really want to exit ([y]/n)?
[cohen@jarrett ~]$ ipython -profile test -logplay ipython_log.py
Activating auto-logging. Current session state plus future input saved.
Filename : ipython_log.py
Mode : append
Output logging : False
Raw input log : False
Timestamping : False
State : active
*******
* TEST *
*******
Replaying log...
Loading log file <ipython_log.py> one line at a time...
Finished replaying log file <ipython_log.py>
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
Type "copyright", "credits" or "license" for more information.
IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
IPython profile: test
In [1]: os
Out[1]: <module 'os' from '/usr/lib/
In [2]: n
Out[2]: 5.2000000000000002
So to make a long story short : there is a faulty behavior of the logger that does not correctly save the profile used.
Can someone confirm this one?