Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash - ipython qtconsole, %quickref #724

Closed
ghost opened this issue Aug 23, 2011 · 12 comments · Fixed by #725
Closed

crash - ipython qtconsole, %quickref #724

ghost opened this issue Aug 23, 2011 · 12 comments · Fixed by #725
Milestone

Comments

@ghost
Copy link

ghost commented Aug 23, 2011

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
Copy link
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
Copy link
Member

minrk commented Aug 23, 2011

Can you check if this branch fixes your issue?

@fperez
Copy link
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
Copy link
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?

@ghost
Copy link
Author

ghost commented 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?

@epatters
Copy link
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.

@epatters
Copy link
Contributor

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

@minrk
Copy link
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
Copy link
Contributor

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

@ghost
Copy link
Author

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

@epatters
Copy link
Contributor

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

@ghost
Copy link
Author

ghost commented 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.

minrk added a commit to minrk/ipython that referenced this issue Aug 24, 2011
require PySide >= 1.0.3 or PyQt4 >= 4.7

closes ipythongh-724
@minrk minrk closed this as completed in 6cf495c Sep 9, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
require PySide >= 1.0.3 or PyQt4 >= 4.7

closes ipythongh-724
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
don't assume cursor.selectedText() is a string

closes ipythongh-724
closes ipythongh-655
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants