smr99 / lego-hub-tk

Pythonic connector for the LEGO Mindstorms/Spike Prime robot hub
MIT License
34 stars 5 forks source link

ModuleNotFoundError: No module named 'bluetooth.linux' #13

Closed ppalaga closed 2 years ago

ppalaga commented 2 years ago

First of all, thanks for your effort to allow programming the Lego Hub on Linux!

This is what happens when I run python3 run_command.py ls:

$ python3 run_command.py ls
Traceback (most recent call last):
  File "/home/ppalaga/orgs/python/lego-hub-tk/run_command.py", line 17, in <module>
    from comm.HubClient import ConnectionState, HubClient
  File "/home/ppalaga/orgs/python/lego-hub-tk/comm/HubClient.py", line 5, in <module>
    from comm.MultiplexedConnectionMonitor import MultiplexedConnectionMonitor
  File "/home/ppalaga/orgs/python/lego-hub-tk/comm/MultiplexedConnectionMonitor.py", line 2, in <module>
    from comm.BluetoothConnectionMonitor import BluetoothConnectionMonitor
  File "/home/ppalaga/orgs/python/lego-hub-tk/comm/BluetoothConnectionMonitor.py", line 4, in <module>
    import bluetooth
  File "/home/ppalaga/.local/lib/python3.9/site-packages/bluetooth/__init__.py", line 18, in <module>
    from bluetooth.linux import *
ModuleNotFoundError: No module named 'bluetooth.linux'

I have installed the prerequisites via pip3 install -r requirements.txt before running run_command.py ls. I am quite new to Python and pip, maybe I am missing something basic.

I am on Fedora 34.

smr99 commented 2 years ago

Hi Peter!

On Tuesday, December 28, 2021 9:56:34 A.M. CST Peter Palaga wrote:

File "/home/ppalaga/.local/lib/python3.9/site-packages/bluetooth/ init.py", line 18, in from bluetooth.linux import * ModuleNotFoundError: No module named 'bluetooth.linux'



I have installed the prerequisites via `pip3 install -r requirements.txt`
before running `run_command.py ls`. I am quite new to Python and pip, maybe
I am missing something basic.

I don't think you are missing anything. I looked at line 18 in the file mentioned above and on my system it does NOT read "from bluetooth.linux import *". My hunch is that you have a different version of the file than I do.

I have not updated this stuff in months.

My copy of "bluetooth/init.py" has a line that reads:

version = 0.41

What version is in your file?

Thanks, -Steve

ppalaga commented 2 years ago

Thanks Steve, that helped! I had pybluez2 0.44. I did the following to make it work:

pip uninstall pybluez2
pip install 'pybluez2==0.41'