[IPython-dev] running python+ipython under gdb on darwin

Michael Abshoff mabshoff@googlemail....
Sat Jan 17 07:15:26 CST 2009


I am running into problems when attempting to run Sage under gdb on
Darwin. We are still using ipython 0.8.4, but the code in question is
identical in ipython 0.9.1:

>From rlineimpl.py:

# Test to see if libedit is being used instead of GNU readline.
# Thanks to Boyd Waters for this patch.
uses_libedit = False
if sys.platform == 'darwin' and have_readline:
    import commands
    (status, result) = commands.getstatusoutput( "otool -L %s | grep
libedit" % _rl.__file__ )
    if status == 0 and len(result) > 0:
        # we are bound to libedit - new in Leopard
        _rl.parse_and_bind("bind ^I rl_complete")
        print "Leopard libedit detected."
        uses_libedit = True

commands.getstatusoutput() causes the following exception to be thrown on OSX:

(gdb) r
Starting program:
warning: posix_spawn failed, trying execvp, error: 86
Traceback (most recent call last):
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/tmp/.doctest_ell_finite_field.py",
line 2, in <module>
    from sage.all_cmdline import *;
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/all_cmdline.py",
line 14, in <module>
    from sage.all import *
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/all.py",
line 64, in <module>
    from sage.misc.all       import *         # takes a while
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/misc/all.py",
line 16, in <module>
    from sage_timeit_class import timeit
  File "sage_timeit_class.pyx", line 3, in sage.misc.sage_timeit_class
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/misc/sage_timeit.py",
line 12, in <module>
    import timeit as timeit_, time, math, preparser, interpreter
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/misc/interpreter.py",
line 95, in <module>
    import IPython.ipapi
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/__init__.py",
line 57, in <module>
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/ipstruct.py",
line 22, in <module>
    from IPython.genutils import list2dict2
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/genutils.py",
line 118, in <module>
    import IPython.rlineimpl as readline
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/rlineimpl.py",
line 37, in <module>
    (status, result) = commands.getstatusoutput( "otool -L %s | grep
libedit" % _rl.__file__ )
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/commands.py",
line 54, in getstatusoutput
    text = pipe.read()
IOError: [Errno 4] Interrupted system call

Note that this is a 64 bit build of Sage, but the 32 bit build is also
affected. Getting rid of the libedit test fixes the issue for Sage (we
link against readline on all platforms anyway), but I wanted to pick
your brains if there was a cleaner fix. While googling for the problem
I found this:


But I am not so sure this is even applicable here.



More information about the IPython-dev mailing list