LineDemo does not work

Bug #518984 reported by robitaille on 2010-02-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I'm trying to use the iPython demo mode. I created a file called containing:

print 1
print 2
print 3

and then launched iPython and did the following:

In [1]: from IPython.demo import LineDemo

In [2]: d = LineDemo('')

In [3]: d()
********************* <> block # 0 (5 remaining) *********************

********************************** output: **********************************
NameError Traceback (most recent call last)

/Users/tom/Library/Python/2.6/site-packages/ipython-0.10-py2.6.egg/IPython/demo.pyc in runlines(self, source)
    400 """Execute a string with one or more lines of code"""
--> 402 exec source in self.user_ns
    404 def __call__(self,index=None):

/Users/tom/tmp/<string> in <module>()
----> 1

NameError: name 'p' is not defined

As pointed out on by another user, in in LineDemo.reload, the line that says:

src_b = [l for l in self.fobj.readline() if l.strip()]

should say:

src_b = [l for l in self.fobj.readlines() if l.strip()]

Currently it's trying to execute all the letters in the first line instead of all the lines in the file.

Using iPython 0.10 on MacOS 10.6 with Python 2.6 64-bit

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

Other bug subscribers