鍍金池/ 問答/區(qū)塊鏈  Python  數(shù)據(jù)庫  網(wǎng)絡(luò)安全/ python下使用bluez報(bào)錯(cuò):方法不存在

python下使用bluez報(bào)錯(cuò):方法不存在

代碼:

$ python
>>> import dbus
>>> bus = dbus.SystemBus()
>>> manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')
>>> foo = manager.DefaultAdapter()

錯(cuò)誤提示:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "DefaultAdapter" with signature "" on interface "org.bluez.Manager" doesn't exist
回答
編輯回答
離人歸

dir(manager)查看所有方法和屬性,有時(shí)候同樣的庫,版本不一樣,方法也會(huì)不同

2017年10月8日 01:00
編輯回答
疚幼

org.bluez.Service 在bluez5已經(jīng)被移除 :

The removal of the org.bluez.Service interface (used for registering
SDP records and authorization) and the introduction of a new
org.bluez.Profile1 interface

4)移除org.bluez.Service接口(用于注冊(cè)SDP records and
authorization),引入新的org.bluez.Profile1接口。

from: http://www.bluez.org/bluez-5-...

2017年9月17日 08:35