使用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
,但也没有任何效果。