【问题标题】:python dbus how to get object valuepython dbus如何获取对象值
【发布时间】:2017-09-27 11:56:40
【问题描述】:
import dbus

session_bus = dbus.SessionBus()
print(session_bus)

serviceName = "com.qcom.QCAT"
service = session_bus.get_object(
    serviceName, # Bus name
    "/Applications/QCAT/QCAT/bin/QCAT", # Object path
)

print(service)
appVersion = service.get_dbus_method('AppVersion')
print(appVersion)

我想在这段代码中打印 appVersion,但它实际上是打印对象 _DeferreMethod 对象 如何获得 AppVersion 的值。(arguemnts) pic

【问题讨论】:

    标签: python dbus


    【解决方案1】:

    您在appVersion 中获取有关该方法的信息,而不是调用它并获取它的返回值。尝试添加类似:

    service_application = dbus.Interface(service, 'com.qcom.Application')
    appVersion = service_application.AppVersion()
    print(appVersion)
    

    【讨论】:

      猜你喜欢
      • 2013-02-21
      • 2019-03-04
      • 2012-01-21
      • 1970-01-01
      • 2015-11-02
      • 2019-08-08
      • 1970-01-01
      • 2021-04-22
      相关资源
      最近更新 更多