issue in replaying logs with profile

Bug #245198 reported by Johann Cohen-Tanugi on 2008-07-03
2
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/ipy_profile_test.py
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/python2.5/os.pyc'>

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({'__allownew': True, 'log': 1, 'logfile': 'ipython_log.py', 'profile': ''})
#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/<ipython console> in <module>()

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/python2.5/os.pyc'>

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/python2.5/os.pyc'>

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.

Brian Granger (ellisonbg) wrote :

Can someone confirm this one?

Changed in ipython:
status: New → Incomplete
Download full text (7.0 KiB)

Old entry, but I just retested my description with ipython 0.9.1 (recent
bazaar build) and I still have exactly the same issue. The logger does not
honor the profile used.
let me know if I can help.
Johann

On Tue, Apr 21, 2009 at 5:51 AM, Brian Granger <email address hidden> wrote:

> Can someone confirm this one?
>
> ** Changed in: ipython
> Status: New => Incomplete
>
> --
> issue in replaying logs with profile
> https://bugs.launchpad.net/bugs/245198
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in IPython - Enhanced Interactive Python: Incomplete
>
> 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/ipy_profile_test.py
> 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/python2.5/os.pyc'>
>
> 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({'__allownew': True, 'log': 1, 'logfile':
> 'ipython_log.py', 'profile': ''})
> #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...

Read more...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers