2

I got python2.7 installed on a raspeberry pi 4 with a script which use the bluethooth library(pybluez) but the script was crashing when importing the library. Si i simply try to import the bluetooth library on a python2.7 shell and i have the same error "AttributeEror: attribute 'doc' of 'instancemethod' objects is not writable"

I can't switch to python3 and i don't understand why it's not working so if someone got an issue to this i would be grateful :)

code:

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

Thanks

Mat
  • 31
  • 1
  • 3
  • 1
    It's not clear what code you are using. `https://github.com/karulis/pybluez/blob/master/bluetooth/__init__.py` doesn't even *have* a line 282. – chepner Jan 24 '20 at 14:33
  • Yes sorry, i am just trying to import the library "bluetooth" that i run in a python shell and then i got the message starting from "Traceback" . – Mat Jan 24 '20 at 21:19
  • `bluetooth` is not in the standard library, so you must have installed the code from somewhere. We can't help you if we don't know what code that is. – chepner Jan 24 '20 at 21:21
  • i did " sudo apt-get install python-bluez" to install the library – Mat Jan 24 '20 at 21:37
  • Maybe i got the wrong version i don't know .. there is the code("__init__") on my github --> https://github.com/mathieu-gouleau/prd – Mat Jan 28 '20 at 09:15

2 Answers2

2

i had the same issue and fixxed it by using this init.py

somewhere near line 8 it says "version" and the "old" init.py i used was 0.23 the one working is 0.22. Btw i used pip install to get the 0.23.

ZéroTwó
  • 21
  • 5
0

Another means to fix... Installed bluez with the following: sudo apt-get install bluetooth sudo apt-get install bluez libbluetooth-dev sudo python -m pip install pybluez

and got this error. fixed it by using python3 and installing pybluez with sudo python3 -m pip install pybluez

btw the install is based on:https://blog.adafruit.com/2020/04/17/starting-with-raspberry-pi-bluetooth-python-python-bluetooth-raspberrypi-piday-raspberry_pi/