[IPython-dev] Indentation errors not correctly displayed

Anand Patil anand.prabhakar.patil@gmail....
Tue Oct 28 09:53:47 CDT 2008


Hi all,
Running this program with bad indentation

for i in range(3):
pass

I get the following.

Thanks,
Anand


sihpc03:Desktop anand$ ipython
Python 2.5.1 (r251:54863, Feb  4 2008, 21:48:13)
Type "copyright", "credits" or "license" for more information.

IPython 0.9.beta3 -- 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]: run test
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)

/Users/anand/Desktop/<ipython console> in <module>()

/Library/Python/2.5/site-packages/IPython/iplib.pyc in ipmagic(self, arg_s)
    951         else:
    952             magic_args = self.var_expand(magic_args,1)
--> 953             return fn(magic_args)
    954
    955     def ipalias(self,arg_s):

/Library/Python/2.5/site-packages/IPython/Magic.pyc in magic_run(self,
parameter_s, runner)
   1679                     else:
   1680                         # regular execution
-> 1681
runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
   1682                 if opts.has_key('i'):
   1683                     self.shell.user_ns['__name__'] = __name__save

/Library/Python/2.5/site-packages/IPython/iplib.pyc in safe_execfile(self,
fname, *where, **kw)
   2658                     execfile(fname,*where)
   2659             except SyntaxError:
-> 2660                 self.showsyntaxerror()
   2661                 warn('Failure executing file: <%s>' % fname)
   2662             except SystemExit,status:

/Library/Python/2.5/site-packages/IPython/iplib.pyc in showsyntaxerror(self,
filename)
   1481                     # If that failed, assume SyntaxError is a string
   1482                     value = msg, (filename, lineno, offset, line)
-> 1483         self.SyntaxTB(etype,value,[])
   1484
   1485     def debugger(self,force=False):

/Library/Python/2.5/site-packages/IPython/iplib.pyc in __call__(self, etype,
value, elist)
    171     def __call__(self, etype, value, elist):
    172         self.last_syntax_error = value
--> 173         ultraTB.ListTB.__call__(self,etype,value,elist)
    174
    175     def clear_err_state(self):

/Library/Python/2.5/site-packages/IPython/ultraTB.pyc in __call__(self,
etype, value, elist)
    378     def __call__(self, etype, value, elist):
    379         Term.cout.flush()
--> 380         print >> Term.cerr, self.text(etype,value,elist)
    381         Term.cerr.flush()
    382

/Library/Python/2.5/site-packages/IPython/ultraTB.pyc in text(self, etype,
value, elist, context)
    390                                 (Colors.normalEm, Colors.Normal) +
'\n')
    391             out_string.extend(self._format_list(elist))
--> 392         lines = self._format_exception_only(etype, value)
    393         for line in lines[:-1]:
    394             out_string.append(" "+line)

/Library/Python/2.5/site-packages/IPython/ultraTB.pyc in
_format_exception_only(self, etype, value)
    494
    495         # vds:>>
--> 496         if have_filedata:
    497             __IPYTHON__.hooks.synchronize_with_editor(filename,
lineno, 0)
    498         # vds:<<

UnboundLocalError: local variable 'have_filedata' referenced before
assignment

In [2]:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20081028/c945f1d4/attachment.html 


More information about the IPython-dev mailing list