TheWeirdDev / Bluetooth_Headset_Battery_Level

A python script to get battery level from Bluetooth headsets
GNU General Public License v3.0
760 stars 83 forks source link

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats #71

Closed StMartin81 closed 2 years ago

StMartin81 commented 2 years ago

When trying to run the program I get the following error message:

Traceback (most recent call last):
  File "/usr/bin/bluetooth-headset-battery-level", line 166, in <module>
    main()
  File "/usr/bin/bluetooth-headset-battery-level", line 163, in main
    print("Battery level for {} is {}".format(device, str(query)))
  File "/usr/bin/bluetooth-headset-battery-level", line 93, in __str__
    return "{:.0%}".format(self._perform_query() / 100)
  File "/usr/bin/bluetooth-headset-battery-level", line 105, in _perform_query
    sock.send(b"+BRSF: 1024")
  File "/usr/bin/bluetooth-headset-battery-level", line 66, in send
    return super().send(b"\r\n" + data + b"\r\n")
  File "<string>", line 3, in send
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

This happened with Python 3.10.1 on Archlinux.

drskalman commented 2 years ago

It is a pybluez issue: https://github.com/pybluez/pybluez/issues/426 and there is a pull request to fix it: https://github.com/pybluez/pybluez/pull/427

StMartin81 commented 2 years ago

I've tried to google the error code but haven't found the comment for pybluez. Thanks for the reply!