使用 pybluez 进行 python 蓝牙发现

发布于 2024-10-05 18:28:39 字数 1198 浏览 2 评论 0原文

我正在尝试运行此脚本:

import PyOBEX
import bluetooth

print "performing inquiry..."

nearby_devices = bluetooth.discover_devices(lookup_names = True)

print "found %d devices" % len(nearby_devices)

for name, addr in nearby_devices:
    print " %s - %s" % (addr, name)

但是我在终端中收到未实现的错误。这是我得到的输出:

Last login: Sat Dec  4 20:59:06 on ttys001
You have mail.
cd '/Users/riceje7/School/NMD 430/' && '/usr/bin/pythonw'  '/Users/riceje7/School/NMD 430/BluetoohLocator.py'  && echo Exit status: $? && exit 1
Joseph-Rices-MacBook-Pro:~ riceje7$ cd '/Users/riceje7/School/NMD 430/' && '/usr/bin/pythonw'  '/Users/riceje7/School/NMD 430/BluetoohLocator.py'  && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Users/riceje7/School/NMD 430/BluetoohLocator.py", line 2, in <module>
import bluetooth
File "/Library/Python/2.6/site-packages/bluetooth/__init__.py", line 36, in <module>
from osx import *
File "/Library/Python/2.6/site-packages/bluetooth/osx.py", line 3, in <module>
raise NotImplementedError
NotImplementedError

任何人都可以帮我弄清楚发生了什么以及为什么脚本无法正常运行吗?

i am trying to run this script:

import PyOBEX
import bluetooth

print "performing inquiry..."

nearby_devices = bluetooth.discover_devices(lookup_names = True)

print "found %d devices" % len(nearby_devices)

for name, addr in nearby_devices:
    print " %s - %s" % (addr, name)

however i am getting a not implemented error in terminal. this is the out put that i get:

Last login: Sat Dec  4 20:59:06 on ttys001
You have mail.
cd '/Users/riceje7/School/NMD 430/' && '/usr/bin/pythonw'  '/Users/riceje7/School/NMD 430/BluetoohLocator.py'  && echo Exit status: $? && exit 1
Joseph-Rices-MacBook-Pro:~ riceje7$ cd '/Users/riceje7/School/NMD 430/' && '/usr/bin/pythonw'  '/Users/riceje7/School/NMD 430/BluetoohLocator.py'  && echo Exit status: $? && exit 1
Traceback (most recent call last):
File "/Users/riceje7/School/NMD 430/BluetoohLocator.py", line 2, in <module>
import bluetooth
File "/Library/Python/2.6/site-packages/bluetooth/__init__.py", line 36, in <module>
from osx import *
File "/Library/Python/2.6/site-packages/bluetooth/osx.py", line 3, in <module>
raise NotImplementedError
NotImplementedError

can anyone help me figure out what is going on and why the script won't run properly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

早乙女 2024-10-12 18:28:39

init 的源代码。 py 具有

elif sys.platform == "darwin":
    from osx import *

osx 的源代码。 py

from btcommon import *

raise NotImplementedError

这与网页中只提到 Linux 和 Windows 实现是一致的。您可能需要向开发人员咨询其路线图上有关 OSX 支持的信息。

The source code for init.py has

elif sys.platform == "darwin":
    from osx import *

And the source code for osx.py is

from btcommon import *

raise NotImplementedError

This is consistent with the web page that only mentions Linux and Windows implementations. You'll probably have to check with the developer about OSX support on their roadmap.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文