Bugreport: QDBusArgument does not work with PyQt6

JakobDev jakobdev at gmx.de
Thu Jun 30 18:55:42 BST 2022


This is strange. It crashes with message.setArguments() before it send
anything, so there is nothing dbus-monitor could show. I have now
attached a simpler code. The line
arg.add(QDBusVariant(QByteArray(b"Hello"))) is the culprit. If I comment
them out, it doesn't crash.- Also no crash under PyQt5 with this line.

Am 30.06.22 um 19:32 schrieb Phil Thompson:
> Sorry, I need something much, much simpler to work with.
>
> Running your example with dbus-monitor running for both PyQt5 and
> PyQt6 shows the same arguments suggesting that the marshalling is
> working the same.
>
> Phil
>
> On 30/06/2022 12:34, JakobDev wrote:
>> It's the QDbusArgument Object that causes the problem. i don't now, if
>> QBytesArray needs to be implementet too in PyQt6, but would be nice if
>> we just could use the normal python bytes.
>>
>> I'm trying to use the PrepareInstall Method of the DynamicLauncher
>> Portal (Documenation:
>> https://flatpak.github.io/xdg-desktop-portal/#gdbus-method-org-freedesktop-portal-DynamicLauncher.PrepareInstall)
>>
>> It is pretty new. The doc says, it needs a GIcon, but it needs just
>> the text Icon followed by the Bytes of a Image file. As far as I know
>> KDE 525 is currently the only majror DE that has it impelemented. I
>> have atached a ZIP file which includes all needed files. If you run
>> this code on a system that has the Portal implemented, it should work.
>> If you use PyQt6 instead of PyQt5, it didn't work.
>>
>> KDE has implementet a test of the Portal which uses C++ with Qt5. You
>> can find the source here:
>> https://invent.kde.org/libraries/xdg-portal-test-kde/-/blob/57ccdb68a24f618dbe1254cb531bc96be34e27e7/src/xdgportaltest.cpp#L807
>>
>>
>>
>> The implementation for the GIcon function can be found here:
>> https://gitlab.gnome.org/GNOME/glib/-/blob/89b1fe42d761d68735e8755dec8cf62c8dfc5eef/gio/gbytesicon.c#L203-210
>>
>>
>>
>> I hope that is all you need to make this work under PyQt6.
>>
>> Gesendet: Donnerstag, 30. Juni 2022 um 12:42 Uhr
>> Von: "Phil Thompson" <phil at riverbankcomputing.com>
>> An: "JakobDev" <jakobdev at gmx.de>
>> Cc: pyqt at riverbankcomputing.com
>> Betreff: Re: Bugreport: QDBusArgument does not work with PyQt6
>> On 29/06/2022 12:48, JakobDev wrote:
>>> If you run the attached code with PyQt5 everything works as
>> expected.
>>> but if you chance the imports from PyQt5 to PyQt6 you get this
>> error:
>>> QDBusMarshaller: type `PyQt_PyObject' (65729) is not registered with
>>> D-BUS. Use qDBusRegisterMetaType to register it. It looks like PyQt6
>>> doesn't accept QDBusArgument.
>>
>> What is the argument that is causing the problem?
>>
>> While it would be easy enough to register PyQt_PyObject there wouldn't
>> be much point if the other end doesn't know what to do with it.
>>
>> Phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus.py
Type: text/x-python
Size: 505 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220630/4341a1aa/attachment-0001.py>


More information about the PyQt mailing list