Bluetooth_Headset_Battery_Level icon indicating copy to clipboard operation
Bluetooth_Headset_Battery_Level copied to clipboard

Issue installing

Open chaoscreater opened this issue 5 years ago • 2 comments

I've got this working on an old Win10 machine and that's all good. But on a new Win10 machine (same Win10 build 1909) with the same Python version (3.7.2), I can't seem to get this to run.

When running this: bluetooth_battery cc:98:8b:56:8c:ad

I get this:

PS C:\Users\Ricky\pybluez-0.23> bluetooth_battery cc:98:8b:56:8c:ad                                                                                           Traceback (most recent call last):
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Ricky\AppData\Local\Programs\Python\Python37-32\Scripts\bluetooth_battery.exe\__main__.py", line 4, in <module>
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\site-packages\bluetooth_battery\bluetooth_battery.py", line 12, in <module>
    import bluetooth
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\site-packages\pybluez-0.23-py3.7-win32.egg\bluetooth\__init__.py", line 39, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\site-packages\pybluez-0.23-py3.7-win32.egg\bluetooth\msbt.py", line 4, in <module>
AttributeError: module 'bluetooth._msbt' has no attribute 'initwinsock'

At first, I thought maybe it's to do with Pybluez. So I've tried installing v0.23 as well as v0.3. Both Pybluez versions installed fine and I was able to install bluetooth_battery OK as well. But whenever I run it, I get the same error message regardless of which Pybluez version I'm using.

chaoscreater avatar Aug 05 '20 00:08 chaoscreater

This issue is more related to PyBluez than to this repository. Try running:

import bluetooth

in a Python shell and if it gives you an error, open a new issue in https://github.com/pybluez/pybluez/ repository and ask them for help. They might know what is wrong.

Also there is a discussion in this issue that might help you: https://github.com/pybluez/pybluez/issues/180

TheWeirdDev avatar Aug 05 '20 06:08 TheWeirdDev

this might be the same issue as pybluez/pybluez#369

cheriimoya avatar Jan 19 '21 13:01 cheriimoya