0

I'm getting an ImportError "no module named dbus" when I reinstalled it

("sudo apt-get install --reinstall dbus")

It wrote me

"0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 15 not upgraded"

Can anyone help me? I'm trying to use this github repository: "keyboard_mouse_emulate_on_raspberry"

I need to fix that because of send_string.py file is giving me an error

Traceback (most recent call last):
  File "send_string.py", in line 4, in <module>
    import dbus
  • 1
    The issues with `dbus` not being available in Python on Raspbian (Raspberry Pi OS) is if you are using the `lite` version or have a Python Virtual Environment. I also think the package to install is `sudo apt-get install python3-dbus`. A simpler test would be do the following on the command line `python3 -c "import dbus; print(dbus.__file__)"` and update your question with what that returns. For me it reports `/usr/lib/python3/dist-packages/dbus/__init__.py` – ukBaz Apr 14 '22 at 09:25

1 Answers1

1

Use pip, not apt-get.

pip install dbus

or

python pip install dbus

or

python -m pip install dbus
Kovy Jacob
  • 489
  • 2
  • 16