[IPython-user] Using __IP.push()

Frédéric Mantegazza mantegazza at ill.fr
Wed Mar 23 03:08:21 CST 2005


I'm trying to use the __IP.push() method to have a line executed by IPython,
but it does not work. I think I don't use it in the correct way, but I can't
find the solution. Here is the error I get:

>>> __IP.push("print 4+4")
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "/home/fma/develop/PyMAD/client/ipython/IPython/ultraTB.py", line 434, in text
---------------------------------------------------------------------------
exceptions.RuntimeError                              Traceback (most recent call last)

/home/fma/<console>

/usr/lib/python2.3/code.py in push(self, line)
    259         self.buffer.append(line)
    260         source = "\n".join(self.buffer)
--> 261         more = self.runsource(source, self.filename)
    262         if not more:
    263             self.resetbuffer()

/home/fma/develop/PyMAD/client/ipython/IPython/iplib.py in runsource(self, source, filename, symbol)
   1464         self.code_to_run = code
   1465         # now actually execute the code object
-> 1466         self.runcode(code)
   1467         return False
   1468

/home/fma/develop/PyMAD/client/ipython/IPython/iplib.py in runcode(self, code_obj)
   1490             self.CustomTB(etype,value,tb)
   1491         except:
-> 1492             self.showtraceback()
   1493         else:
   1494             if code.softspace(sys.stdout, 0):

/home/fma/develop/PyMAD/client/ipython/IPython/iplib.py in showtraceback(self, exc_tuple)
   1120             sys.last_value = value
   1121             sys.last_traceback = tb
-> 1122             self.InteractiveTB()
   1123             if self.InteractiveTB.call_pdb and self.has_readline:
   1124                 # pdb mucks up readline, fix it back

/home/fma/develop/PyMAD/client/ipython/IPython/ultraTB.py in __call__(self, etype, evalue, etb, out, tb_offset)
    786             self.tb_offset = tb_offset
    787         else:
--> 788             print >> out, self.text()
    789         self.debugger()
    790

/home/fma/develop/PyMAD/client/ipython/IPython/ultraTB.py in text(self, etype, value, tb, context, mode)
    793             etype,value,tb = sys.exc_info()
    794         self.tb = tb
--> 795         return FormattedTB.text(self,etype,value,tb,context=5,mode=mode)
    796
    797 #---------------------------------------------------------------------------

/home/fma/develop/PyMAD/client/ipython/IPython/ultraTB.py in text(self, etype, value, tb, context, mode)
    716         if mode in self.verbose_modes:
    717             # verbose modes need a full traceback
--> 718             return VerboseTB.text(self,etype, value, tb,context=5)
    719         else:
    720             # We must check the source cache because otherwise we can print

/home/fma/develop/PyMAD/client/ipython/IPython/ultraTB.py in text(self, etype, evalue, etb, context)
    442             # reproduce the problem.
    443             inspect_error()
--> 444             traceback.print_exc(file=Term.cerr)
    445             info('\nUnfortunately, your original traceback can not be constructed.\n')
    446             return ''

/usr/lib/python2.3/traceback.py in print_exc(limit, file)
    208     try:
    209         etype, value, tb = sys.exc_info()
--> 210         print_exception(etype, value, tb, limit, file)
    211     finally:
    212         etype = value = tb = None

/usr/lib/python2.3/traceback.py in print_exception(etype, value, tb, limit, file)
    121     if tb:
    122         _print(file, 'Traceback (most recent call last):')
--> 123         print_tb(tb, limit, file)
    124     lines = format_exception_only(etype, value)
    125     for line in lines[:-1]:

/usr/lib/python2.3/traceback.py in print_tb(tb, limit, file)
     66         _print(file,
     67                '  File "%s", line %d, in %s' % (filename,lineno,name))
---> 68         line = linecache.getline(filename, lineno)
     69         if line: _print(file, '    ' + line.strip())
     70         tb = tb.tb_next

/usr/lib/python2.3/linecache.py in getline(filename, lineno)
     12
     13 def getline(filename, lineno):
---> 14     lines = getlines(filename)
     15     if 1 <= lineno <= len(lines):
     16         return lines[lineno-1]

RuntimeError: maximum recursion depth exceeded
                                False
                                False
                                False
                                False
                                [...]

-- 
    Frédéric




More information about the IPython-user mailing list