crash - ipython qtconsole, %quickref #724

Closed
vanandel opened this Issue Aug 23, 2011 · 12 comments

Comments

Projects
None yet
4 participants
@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

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Aug 23, 2011

Member

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.

Member

minrk commented Aug 23, 2011

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.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Aug 23, 2011

Member

Can you check if this branch fixes your issue?

Member

minrk commented Aug 23, 2011

Can you check if this branch fixes your issue?

@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Aug 23, 2011

Member

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

Member

fperez commented Aug 23, 2011

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

@epatters

This comment has been minimized.

Show comment
Hide comment
@epatters

epatters Aug 24, 2011

Contributor

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

Contributor

epatters commented Aug 24, 2011

@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

This comment has been minimized.

Show comment
Hide comment
@vanandel

vanandel Aug 24, 2011

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?

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?

@epatters

This comment has been minimized.

Show comment
Hide comment
@epatters

epatters Aug 24, 2011

Contributor

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.

Contributor

epatters commented Aug 24, 2011

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.

@epatters

This comment has been minimized.

Show comment
Hide comment
@epatters

epatters Aug 24, 2011

Contributor

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

Contributor

epatters commented Aug 24, 2011

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

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Aug 24, 2011

Member

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.

Member

minrk commented Aug 24, 2011

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.

@epatters

This comment has been minimized.

Show comment
Hide comment
@epatters

epatters Aug 24, 2011

Contributor

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

Contributor

epatters commented Aug 24, 2011

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

@vanandel

This comment has been minimized.

Show comment
Hide comment
@vanandel

vanandel Aug 24, 2011

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

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

@epatters

This comment has been minimized.

Show comment
Hide comment
@epatters

epatters Aug 24, 2011

Contributor

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

Contributor

epatters commented Aug 24, 2011

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

@vanandel

This comment has been minimized.

Show comment
Hide comment
@vanandel

vanandel Aug 24, 2011

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.

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.

minrk added a commit to minrk/ipython that referenced this issue Aug 24, 2011

version check Qt bindings in external.qt
require PySide >= 1.0.3 or PyQt4 >= 4.7

closes gh-724

@minrk minrk closed this in 6cf495c Sep 9, 2011

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

version check Qt bindings in external.qt
require PySide >= 1.0.3 or PyQt4 >= 4.7

closes gh-724

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Merge pull request #725 from minrk/i724
don't assume cursor.selectedText() is a string

closes gh-724
closes gh-655
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment