【发布时间】:2020-05-10 21:30:02
【问题描述】:
我在 raspeberry pi 4 上安装了 python2.7,其脚本使用了 bluethooth 库 (pybluez),但在导入库时脚本崩溃了。 我只是尝试在 python2.7 shell 上导入蓝牙库,我有同样的错误“AttributeEror: '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
谢谢
【问题讨论】:
-
不清楚您使用的是什么代码。
https://github.com/karulis/pybluez/blob/master/bluetooth/__init__.py甚至没有有第 282 行。 -
是的对不起,我只是想导入我在 python shell 中运行的库“蓝牙”,然后我收到了从“Traceback”开始的消息。
-
bluetooth不在标准库中,因此您一定是从某个地方安装了代码。如果我们不知道那是什么代码,我们将无法帮助您。 -
我做了“sudo apt-get install python-bluez”来安装库
-
也许我弄错了我不知道的版本.. 我的 github 上有代码("init") --> github.com/mathieu-gouleau/prd