You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue with creating QApplication in QT backend #15100
In the file backend_qt5.py in line 126 a new QApplication object is created. However, the passed argument is a list with a binary string. This causes PySide2 to print ugly
I have investigated the issue and it seems that for #9162, the critical commit is fb6fa1d. You can safely revert 52eb8b8 and the bug #9162 is still not present.
Ok, but the problem only happens in Python2 (see the u"Hello" in https://bugreports.qt.io/browse/PYSIDE-75). It is not present in Python3. And in Python2 , the string withou the b in the beginning is not a unicode, so you can safely remove it. Check that the following code works with both Python versions:
The last commit to pyside dates back to October 2015 (https://github.com/pyside/PySide) which is more than a year earlier than the release of the oldest supported Python (Py 3.6, December 2016 https://www.python.org/downloads/release/python-360/). Given that we can't even test it properly, I think it's time to call it quits on pyside(1)...
I think the question we need answered is: Is there a version of pyside that works with py36 and requires a bytes object as input?
There is no such version to my knowledge. According to my tests PYSIDE-75 is only Python2 issue. Actually you must always pass an str object and in Python2 b"matplotlib" is such an object. In Python3 it is not.
Actually, in Python3, passing b"matplotlib" is a bug. In both PySide and PySide2 result in the app.arguments() returning [''], which is not correct (it should return ['matplotlib'] and this is what both PyQt4 and PyQt5 do). I don't think this really matters in this particular use case, but it is not correct anyway.
If you insist on some workaround (which I believe should not be done), you can always do:
Activity
ImportanceOfBeingErnest commentedon Aug 22, 2019
The confusing bit here is that the
bwas introduced in #9169 to actually fix pyside.tacaswell commentedon Aug 22, 2019
I guess we need some conditional logic on what to pass as the name based on which Qt wrapper we are using. Want to take a crack at that @macdems ?
macdems commentedon Aug 23, 2019
I have investigated the issue and it seems that for #9162, the critical commit is fb6fa1d. You can safely revert 52eb8b8 and the bug #9162 is still not present.
tacaswell commentedon Aug 23, 2019
52eb8b8 is addressing #9162 (comment) which per https://bugreports.qt.io/browse/PYSIDE-75 seems to be fixed in pyside2, but we still support (but not not test super well) pyside + qt4 so I do not think we can revert that commit.
macdems commentedon Aug 23, 2019
Ok, but the problem only happens in Python2 (see the
u"Hello"in https://bugreports.qt.io/browse/PYSIDE-75). It is not present in Python3. And in Python2 , the string withou thebin the beginning is not a unicode, so you can safely remove it. Check that the following code works with both Python versions:Passing
b"matplotlib"to QApplication in Python3, passes bytes, not string, which is incorrect.anntzer commentedon Aug 23, 2019
The last commit to pyside dates back to October 2015 (https://github.com/pyside/PySide) which is more than a year earlier than the release of the oldest supported Python (Py 3.6, December 2016 https://www.python.org/downloads/release/python-360/). Given that we can't even test it properly, I think it's time to call it quits on pyside(1)...
macdems commentedon Aug 23, 2019
I suggest that you simply change
b"matplotlib"to `"matplotlib" and check that it works in any case.However, if you insist on some verification, you can make the line look like this:
This will guard you against the unicode literals (
from __future__ import unicode_literals), although I do not see them used inbackend_qt5.py.tacaswell commentedon Aug 23, 2019
We do not support python2 so that conditional will always be True.
I think the question we need answered is: Is there a version of
pysidethat works with py36 and requires a bytes object as input?Trading suppressing a warning for a segfault seems like a bad deal ;)
anntzer commentedon Aug 23, 2019
Both conda-forge and gohlke have pyside for Py3.6 (https://anaconda.org/conda-forge/pyside/files, https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyside), but not Py3.7. So I guess it may be reasonable to drop support for it at the same time as we drop support for Py3.6, which according to my calculations should be around mpl3.3.
macdems commentedon Aug 24, 2019
There is no such version to my knowledge. According to my tests PYSIDE-75 is only Python2 issue. Actually you must always pass an
strobject and in Python2b"matplotlib"is such an object. In Python3 it is not.Actually, in Python3, passing
b"matplotlib"is a bug. In both PySide and PySide2 result in theapp.arguments()returning[''], which is not correct (it should return['matplotlib']and this is what both PyQt4 and PyQt5 do). I don't think this really matters in this particular use case, but it is not correct anyway.If you insist on some workaround (which I believe should not be done), you can always do:
tacaswell commentedon Aug 24, 2019
Great, if this is a python2 only work around, then 👍 on that change. Could you open a PR?
Fixed app creation in qt5 backend (see matplotlib#15100)
Merge pull request #15122 from macdems/master
tacaswell commentedon Aug 26, 2019
closed by #15122