Skip to content
This repository

crash - ipython qtconsole, %quickref #724

Closed
vanandel opened this Issue · 12 comments

4 participants

vanandel Min RK Fernando Perez Evan Patterson
vanandel

I start ipython (both 0.11 and cloned from gitub (90e6e7a) )

on Scientific Linux 6.0 as
ipython qtconsole

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

Min RK
Owner

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.

Min RK minrk referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Min RK
Owner

Can you check if this branch fixes your issue?

Fernando Perez
Owner

@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...

Evan Patterson
Collaborator

@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?

vanandel

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()

Attribute error:
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?

Evan Patterson
Collaborator

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.

Evan Patterson
Collaborator

I should add that your version of PyQt is quite old. Perhaps it is simply buggy.

Min RK
Owner

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.

Evan Patterson
Collaborator

There is a lot of code that assumes that strings are, well, strings. My vote is to have a PyQt version cutoff.

vanandel

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!)

Evan Patterson
Collaborator

A new-ish version of PyQt is likely to be more stable. PySide is still in its infancy at this point.

vanandel

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.

Min RK minrk referenced this issue from a commit in minrk/ipython
Min RK version check Qt bindings in external.qt
require PySide >= 1.0.3 or PyQt4 >= 4.7

closes gh-724
be3e7ed
Min RK minrk closed this in 6cf495c
Brian E. Granger ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Brian E. Granger ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.