[IPython-user] recalling indented blocks -- strange bug

John Hunter jdh2358@gmail....
Sun Jan 10 21:04:26 CST 2010


I am having a surprising problem on ubuntu karmic (9.10) 32bit using
ipython 0.10 (same in the development branch BTW)   In the session
below, I type::

for i in  range(10):
    print i

relying on ipython to autoindent the print line for me -- this works
fine.  But if I then "up arrow" to recall the entire "for" block, the
block execution fails with an indentation error.  Something about
recalling the block from history is causing it to lose the proper
indentation.  This is something I do a lot (on other machines) and
have not seen this so it may be platform/version specific.

msierig@pinchiepie:~> ipython
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- 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]: for i in range(10):
   ...:     print i
   ...:
   ...:
0
1
2
3
4
5
6
7
8
9

# this input clock came from readline history
In [2]: for i in range(10):
    print i
------> print(i)
------------------------------------------------------------
IndentationError: expected an indented block (<ipython console>, line 2)


In [4]: import IPython

In [5]: print IPython.__file__
------> print(IPython.__file__)
/usr/lib/pymodules/python2.6/IPython/__init__.pyc

In [6]:


More information about the IPython-user mailing list