Catch exception in rlineimpl
Bug #416162 reported by
Robert Kern
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Fix Committed
|
High
|
Fernando Perez |
Bug Description
On OS X, the check for libedit/libreadline linkage fails in some circumstances, notably running under PyQt4. The attached patch catches this error and assumes a proper libreadline.
Changed in ipython: | |
status: | In Progress → Fix Committed |
To post a comment you must log in.
Mmh, I hadn't seen this. I just closed the same bug with a slightly different patch:
https:/ /bugs.launchpad .net/ipython/ +bug/411599
What I used was instead:
=== modified file 'IPython/ utils/rlineimpl .py' utils/rlineimpl .py 2010-01-30 00:24:13 +0000 utils/rlineimpl .py 2010-04-25 03:34:23 +0000 getstatusoutput ( "otool -L %s | grep libedit" % _rl.__file__ ) /bugs.launchpad .net/ipython/ +bug/411599. getstatusoutput ( "otool -L %s | grep libedit" % _rl.__file__ )
_rl.parse_ and_bind( "bind ^I rl_complete")
--- IPython/
+++ IPython/
@@ -35,7 +35,19 @@
uses_libedit = False
if sys.platform == 'darwin' and have_readline:
import commands
- (status, result) = commands.
+ # Boyd's patch had a 'while True' here, I'm always a little worried about
+ # infinite loops with such code, so for now I'm taking a more conservative
+ # approach. See https:/
+ for i in range(10):
+ try:
+ (status, result) = commands.
+ break
+ except IOError, (errno, strerror):
+ if errno == 4:
+ continue
+ else
+ break
+
if status == 0 and len(result) > 0:
# we are bound to libedit - new in Leopard
Do you think it makes sense to keep retrying at all, or should we just switch to your approach which does a single try and then skips ahead? Just let me know (I'm not on OSX) and I'll apply your version instead if you think that's the right approach.
Thanks!