当我尝试在python2.7上导入蓝牙时出现错误

时间:2020-01-24 14:26:52

标签: python bluetooth pybluez

我在raspeberry pi 4上安装了python2.7,该脚本使用了使用bluethooth库(pybluez)的脚本,但是导入库时该脚本崩溃了。 我只是尝试在python2.7外壳上导入蓝牙库,并且出现相同的错误“ Attributesror:'instancemethod'对象的属性' doc '是不可写的”

我无法切换到python3,我也不明白为什么它不起作用,所以如果有人对此有疑问,我将不胜感激:)

代码:

Import bluetooth

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/bluetooth/__init__.py", line 282,
in <module>
"""
AtributeError: attribute '__doc__' of 'instancemethod' objects is not writable

谢谢

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,并使用this init .py

修复了该问题

第8行附近的某个地方说“版本”,而我使用的“旧” init.py是0.23,一个是0.22。 顺便说一句,我用pip install得到0.23。