LineDemo does not work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
New
|
Undecided
|
Unassigned |
Bug Description
I'm trying to use the iPython demo mode. I created a file called test.py 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('test.py')
In [3]: d()
*******
p
*******
-------
NameError Traceback (most recent call last)
/Users/
400 """Execute a string with one or more lines of code"""
401
--> 402 exec source in self.user_ns
403
404 def __call_
/Users/
----> 1
2
3
4
5
NameError: name 'p' is not defined
As pointed out on stackoverflow.com by another user, in demo.py in LineDemo.reload, the line that says:
src_b = [l for l in self.fobj.
should say:
src_b = [l for l in self.fobj.
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