Prevent Qt4 from stopping the interpreter#1905
Prevent Qt4 from stopping the interpreter#1905mdboom merged 5 commits intomatplotlib:masterfrom jschueller:master
Conversation
|
Wow. That's kind of obnoxious of PyQt and PySide ::. This should definitely be tested on MS Windows: I'm not crazy about solving this problem with For Linux, at least, we could just check to the existence and validity of the |
|
I agree, starting a process is a bit heavy. |
There was a problem hiding this comment.
Minor point -- this can probably be removed since it's no longer being used.
|
This is much better. Thanks for your patience on this -- I have one more suggestion. I think that the https://deptinfo-ensip.univ-poitiers.fr/ENS/pyside-docs/PySide/QtGui/QX11Info.html Maybe we check for the existence of that, and then do the |
|
Hi, I tried this; I also removed the subprocess import. J. |
|
Hi, I used a regex to verify DISPLAY: since: J. |
|
Sorry, I only have a non-X11 build of Qt4 on my Mac, so I can't test this. |
|
@mdehoon: It actually would be more valuable if you could test this with the native build of Qt4 on your Mac. In particular, it's an open question as to whether the method used here to determine if we're using an X11 Qt4 is correct or not. So if you wouldn't mind trying it with a native Qt4 build, that would be very helpful. |
|
It seems to work fine: With the native Qt4 build on my Mac, returns False. |
|
Hi, I just tried hasattr(QtGui, "QX11Info") on windows with PyQt4, and it's OK too. J. |
|
Great. Merging. Thanks for the patch. |
Prevent Qt4 from stopping the interpreter
Hi,
This commit prevents Qt4 from stopping the interpreter:
If there's no X server available, or if you export DISPLAY="", and try to initialize a QApp, Qt4 stops:
It's a non-feature of Qt4 to not use exceptions to be lightweight.
But in python, that's not really the spirit, we'd expect a python backtrace, so here's what the patch does:
And it's more like the other backends do:
Regards.
(EDIT by @pelson: Added code blocks)