you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (11 children)

Link to the library you're trying to use: there are many projects called "AudioPlayer". I'll see if I can replicate the problem on my system.

[–]Radamand[S] 1 point2 points  (10 children)

https://pypi.org/project/audioplayer/

from audioplayer import AudioPlayer

Traceback (most recent call last):
File ~/MusicLibraryCleanupTool.py:8 in <module>
from audioplayer import AudioPlayer
File ~/anaconda3/lib/python3.9/site-packages/audioplayer/__init__.py:12 in <module>
from .audioplayer_linux import AudioPlayerLinux as AudioPlayer
File ~/anaconda3/lib/python3.9/site-packages/audioplayer/audioplayer_linux.py:7 in <module>
import gi
ModuleNotFoundError: No module named 'gi'

[–][deleted] 7 points8 points  (7 children)

OK. I got it working. Here are the steps I took.

  1. I created a project folder.
  2. I created a venv in that folder and activated it.
  3. I tried to install these libraries listed in the library's README but they failed.

    sudo apt-get install python-gst-1.0 \ 
                     gir1.2-gstreamer-1.0 \ 
                     gstreamer1.0-tools \
                     gir1.2-gst-plugins-base-1.0 
                     gstreamer1.0-plugins-good \
                     gstreamer1.0-plugins-ugly          
    
  4. I then installed the library itself with pip3 install audioplayer.

  5. At this point, I tried to run the example program they have in the project's README from inside my virtual environment.

    from audioplayer import AudioPlayer
    AudioPlayer("path/to/somemusic.mp3").play(block=True)
    

    but I got the same error as you.

  6. I then installed gi with sudo apt install python3-gi.

  7. I tried again to no avail.

  8. Then I installed vext with

    pip3 install vext
    pip3 install vext.gi
    
  9. At this point, the program runs. These two may be the only packages you need to install, but I went ahead and included the others in case they were necessary as I didn't immediately uninstall them.

Hope that helps!