Bug 409575

Summary: Python plugins don't load with PySide 5.13
Product: [Applications] Falkon Reporter: Antonio Rojas <arojas>
Component: extensionsAssignee: David Rosca <nowrep>
Status: RESOLVED UPSTREAM    
Severity: normal CC: chaz, genstar, jurajoravec
Priority: NOR    
Version: 3.1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Antonio Rojas 2019-07-07 12:09:40 UTC
SUMMARY
With PySide 5.13 (plus commit 5376a134f13124b9b228dd160f151a7c8eccd09a to fix a crash) python plugins don't load:

Traceback (most recent call last):
  File "/usr/lib/qt/plugins/falkon/python/hellopython/hellopython.py", line 29, in init
    plugins = Falkon.MainApplication.instance().plugins()
AttributeError: 'PySide2.QtCore.QCoreApplication' object has no attribute 'plugins'
Comment 1 Antonio Rojas 2019-07-07 14:18:24 UTC
Caused by eihter 80a6f91c553eaf9ed4d7d002a5abb442693e8e08 (which is also the commit that causes the crash) or 5376a134f13124b9b228dd160f151a7c8eccd09a
Comment 2 Chris Hills 2019-09-20 18:06:14 UTC
I have the same problem loading Python plugins with PySide2 5.13, although Falkon does not crash for me.
Comment 3 David Rosca 2019-10-31 10:21:20 UTC
I have no idea what's wrong, it seems like on the Python side it always sees the MainApplication as QCoreApplication object instead. In other words, passing subclass of QCoreApplication to Python will downcast it to QCoreApplication.
Comment 4 Juraj 2019-11-05 12:32:01 UTC
I created an issue (report) at Qt bug tracker.
https://bugreports.qt.io/browse/PYSIDE-1135

In hope that they will know where the problem is.
Comment 5 Juraj 2019-11-18 11:27:28 UTC
Hello, there is a patch in Qt (shiboken) which needs to be tested.
If you want to progress this issue please test the patch and report back to Qt.
The test need to be done with Qt 5.13.1++ (in which it does not work) and with Python 3.7.
Python 3.8 is still unsupported.

You can get the patch at:
https://codereview.qt-project.org/c/pyside/pyside-setup/+/281443

Report back at Qt or here and I will send it for you:
https://bugreports.qt.io/browse/PYSIDE-1135
Comment 7 Antonio Rojas 2019-12-24 13:40:01 UTC
Not fixed yet, unfortunately
Comment 8 Chris Hills 2019-12-29 18:31:39 UTC
Like Antonio I have been able to get past the PyFalkon loading problem, but now stuck here:-

Traceback (most recent call last):
  File "/home/chaz/.local/lib64/plugins/falkon/middleclickloader/__init__.py", line 21, in <module>
    from middleclickloader.mcl_handler import MCL_Handler
  File "/home/chaz/.local/lib64/plugins/falkon/middleclickloader/mcl_handler.py", line 23, in <module>
    from middleclickloader.mcl_settings import MCL_Settings
  File "/home/chaz/.local/lib64/plugins/falkon/middleclickloader/mcl_settings.py", line 21, in <module>
    from middleclickloader.i18n import i18n
  File "/home/chaz/.local/lib64/plugins/falkon/middleclickloader/i18n.py", line 25, in <module>
    localedir = QtCore.QStandardPaths.locate(QtCore.QStandardPaths.GenericDataLocation, 'locale', QtCore.QStandardPaths.LocateDirectory)
TypeError: 'PySide2.QtCore.QStandardPaths.locate' called with wrong argument types:
  PySide2.QtCore.QStandardPaths.locate(StandardLocation, str, LocateOption)
Supported signatures:
  PySide2.QtCore.QStandardPaths.locate(PySide2.QtCore.QStandardPaths.StandardLocation, str, PySide2.QtCore.QStandardPaths.LocateOptions = PySide2.QtCore.QStandardPaths.LocateOption.LocateFile)
Failed to import module "middleclickloader"
Comment 9 Juraj 2020-01-03 16:12:06 UTC
Devs at Qt are working on it, they proposed few patches already.
But because I have limited time to check and properly test them the work is going slowly.
So far all of them failed to meet our needs.

If you wish to help go to:
https://bugreports.qt.io/browse/PYSIDE-1135

> Like Antonio I have been able to get past the PyFalkon loading problem, but now stuck here:-
@ChrisHills as I pointed in linked issue, you did not get any farther, it crashed sooner.

Try this extensions and tell me if it works for you (from my unrefined and unfinished series):
https://github.com/SGOrava/FalkonPythonTutorial/tree/master/extensions/Tutorial3
Comment 10 Juraj 2020-01-03 16:26:31 UTC
*** Bug 415513 has been marked as a duplicate of this bug. ***
Comment 11 Juraj 2020-01-12 12:05:56 UTC
Hello,
it seems we got past the main issue.

See https://codereview.qt-project.org/c/pyside/pyside-setup/+/285655

Some plugins might need some changes though (say Hello to new bugs).
Comment 12 Juraj 2020-02-01 11:04:59 UTC
Fixed with PySide2/Shiboken2 5.14.1 (it should be built against it).