I start ipython (both 0.11 and cloned from gitub (90e6e7a) )
on Scientific Linux 6.0 as
If I type %quickref, it crashes on the following line, with
at_end = len(cursor.selectedText().strip()) == 0
AttributeError: 'NoneType' object has no attribute 'strip'
after that, I see an infinite set of messages:
QCoreApplication::exec: The event loop is already running
As requested, I've mailed the crash report to fperez.net
What Qt bindings are you using, and how were they installed? API specs would suggest that selectedText() can only return a string, which is apparently not the case on your system.
Can you check if this branch fixes your issue?
@epatters, do you think this could be another one of those pyside/pyqt inconsistencies? I don't know for a fact that @vanandel is using pyside, just wondering...
@fperez: It's possible. If it is, I'm surprised we haven't seen it before.
I'd be wary of trying to hack around this in our code because there is nothing about the selectedText method to suggest that it alone would have this kind of type error. My gut response is that he has a bad build of the PySide/PyQt bindings.
@vanandel: Which bindings are using? Where did your build come from? Can you reproduce this reliably? Do you experience other problems if you use the console for an extended period of time?
I'm using PyQt4-4.6.2-8 from an Scientific Linux RPM. I tried the branch you suggested and now ipython crashes in frontend_widget.py in highlightBlock()
54 if string.startswith(prompt):
As my initial report stated, I tried the released ipython 1.11, and cloned from gitub (90e6e7a).
As far as I can tell, this crash happens every time I type '%quickref' in the qtconsole. I haven't tried the console for anything else.
I have not installed pyside -should I try to install it, and if so, should I remove the PyQt4 bindings?
From what you have described, it sounds like you have a broken build of PyQt.
I would suggest that you either build PyQt (but not Qt!) yourself or obtain PySide and hope that you have better luck. If you go the PySide route, you do not have to remove the PyQt bindings, but you can set the environment variable 'QT_API=pyside' to ensure that PySide is used.
I should add that your version of PyQt is quite old. Perhaps it is simply buggy.
I think the most immediate cause of the issue is clear (and more widespread than just selectedText): Your Qt bindings can return None on empty strings, despite the API requiring that these methods always return strings.
The PyQt docs explicitly state that, while some Qt methods that would return empty QStrings often return NULL, PyQt forces them to be empty strings.
Could this be something that has changed since 4.6? I don't think there are many (if any) other users who have been testing against PyQt that old (4.7 is from January 2010).
I think we either have to change all our string checks to allow None, or we have to depend on a PyQt4 that's relatively recent.
There is a lot of code that assumes that strings are, well, strings. My vote is to have a PyQt version cutoff.
Between PySide and PyQt, which binding has been tested more with ipython?
(Thanks to all of you for your quick responses on my bug report - I appreciate it!)
A new-ish version of PyQt is likely to be more stable. PySide is still in its infancy at this point.
I tried building the PyQt 4.8.5 bindings, and configure.py complains:
pylupdate4 and pyrcc4 will not be built because the Qt XML module is missing.
In spite of the fact that /usr/lib64/libQtXml.so exists.
When I build and install PyQt, I'm missing QtGui, so ipython qtconsole won't run. Once you document the minimum version of PyQt needed by ipython, I guess you can close this.
version check Qt bindings in external.qt
require PySide >= 1.0.3 or PyQt4 >= 4.7