失败的dbus请求后PyQt5发送错误消息

时间:2018-07-27 23:00:12

标签: python python-3.x pyqt pyqt5 dbus

使用PyQt5的D-Bus,如何发送错误?一种明显的方法是创建一个错误回复并send()the documentation似乎支持。这是行不通的。

message = QDBusMessage()
error = message.createError(QDBusError.UnknownProperty, "unknown command")
QDBusConnection.systemBus().send(error)

结果:

process 25541: arguments to dbus_message_get_sender() were incorrect, assertion "message != NULL" failed in file ../../dbus/dbus-message.c line 3437.
This is normally a bug in some application using the D-Bus library.
process 25541: arguments to dbus_message_get_serial() were incorrect, assertion "message != NULL" failed in file ../../dbus/dbus-message.c line 1052.
This is normally a bug in some application using the D-Bus library.
process 25541: arguments to dbus_message_set_reply_serial() were incorrect, assertion "reply_serial != 0" failed in file ../../dbus/dbus-message.c line 1071.
This is normally a bug in some application using the D-Bus library.

我不能不说这个错误,因为据我所知,我将消息指定为createError的第二个参数。

如果不是,我尝试使用error << "test message"来输入一条与createReply相同的消息,但这没有任何效果。我也尝试使用createErrorReply代替createError,但也没有任何效果。

0 个答案:

没有答案