bluetooth.btcommon.BluetoothError:(2,“没有这样的文件或目录") [英] bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')

查看:177
本文介绍了bluetooth.btcommon.BluetoothError:(2,“没有这样的文件或目录")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是尝试在 https://code.google.com/p/pybluez/source/browse/trunk/examples/simple/rfcomm-server.py

$ python2 rfcomm-server.py
Traceback (most recent call last):
  File "rfcomm-server.py", line 20, in <module>
    profiles = [ SERIAL_PORT_PROFILE ],
  File "/usr/lib/python2.7/site-packages/bluetooth/bluez.py", line 176, in advertise_service
    raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')

我收到此错误.我的代码在Windows上运行,但无法在Ubuntu 15.10上运行.

I am getting this error. My code is working on windows but I could not work Ubuntu 15.10.

推荐答案

我在Raspbian上也遇到了同样的问题,并通过以下方式解决:

I had the same problem on Raspbian, and solved by:

  • 以兼容模式运行蓝牙,

  • Running bluetooth in compatibility mode,

通过修改/etc/systemd/system/dbus-org.bluez.service

更改

ExecStart=/usr/lib/bluetooth/bluetoothd

进入

ExecStart=/usr/lib/bluetooth/bluetoothd -C

然后添加串行端口配置文件,执行: sudo sdptool add SP

Then adding the Serial Port Profile, executing: sudo sdptool add SP

参考:

https://github.com/karulis/pybluez/issues/161

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆