uint argument in dbus call with python
-
I want to call a dbus method that has one parameter of type uint. I couldn't figure out how to do that, since my number always gets passed as an integer.
Currently, I am calling it like this:
connection = QDBusConnection.sessionBus() message = QDBusMessage.createMethodCall(...) message.setArguments([0, ...])That
0should be of type uint -
I want to call a dbus method that has one parameter of type uint. I couldn't figure out how to do that, since my number always gets passed as an integer.
Currently, I am calling it like this:
connection = QDBusConnection.sessionBus() message = QDBusMessage.createMethodCall(...) message.setArguments([0, ...])That
0should be of type uint@l0drex
Hi. I do not know anything about DBus. But Python does not have anyuinttype.is anything actually going wrong when you pass that
0? I would have thought it would be fine, are you sure this is a problem.I see there is a PyPI package for
uintat https://pypi.org/project/uint/. But I am not sure it is relevant. to your situation. -
@l0drex
Hi. I do not know anything about DBus. But Python does not have anyuinttype.is anything actually going wrong when you pass that
0? I would have thought it would be fine, are you sure this is a problem.I see there is a PyPI package for
uintat https://pypi.org/project/uint/. But I am not sure it is relevant. to your situation.@JonB I am pretty sure, since I get the following error when calling that dbus function:
ValueError: No such method 'Notify' in interface 'org.freedesktop.Notifications' at object path '/org/freedesktop/Notifications' (signature 'sisssasa{sv}i')
Using QtDbusViewer, I get the following signature:susssasa{sv}iSo as far as I understand, my
0is being passed as an integer. Since the actual function has a uint as argument, it doesn't find it.I already tried using
ctypes.c_uint(0)instead, but that didn't work since that is seen as an object. I would like to avoid additional dependencies, since otherwise I could just use the dbus python bindings directly... -
@JonB I am pretty sure, since I get the following error when calling that dbus function:
ValueError: No such method 'Notify' in interface 'org.freedesktop.Notifications' at object path '/org/freedesktop/Notifications' (signature 'sisssasa{sv}i')
Using QtDbusViewer, I get the following signature:susssasa{sv}iSo as far as I understand, my
0is being passed as an integer. Since the actual function has a uint as argument, it doesn't find it.I already tried using
ctypes.c_uint(0)instead, but that didn't work since that is seen as an object. I would like to avoid additional dependencies, since otherwise I could just use the dbus python bindings directly... -
@l0drex
Then How to send unsigned values to dBus from Python ?You can use the
DBusArgumentclass to do this by specifying theQMetaTypeof the argument. -
This is currently tracked in PYSIDE-1904 . There is no good solution yet since PySide6 does not expose QVariant.