skip to Main Content

I try to play a simple sound in my WSL Debian but I cannot fix a long list of errors.
I don’t know what to do more…

Searching different advise on the net, I’have installed

pip install playsound
apt install libcairo2-dev libgirepository1.0-dev gir1.2-gtk-3.0
sudo apt install libxt-dev
pip install pygobject
pip install PyGObject
pip install vext
pip install vext.gi

My script is :

#!/usr/bin/python3
from playsound import playsound
playsound('clock.mp3')

errors are :

> ./sound.py
playsound is relying on another python subprocess. Please use `pip install pygobject` if you want playsound to run more efficiently.
Traceback (most recent call last):
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 261, in <module>
    playsound(argv[1])
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 162, in _playsoundNix
    import gi
ModuleNotFoundError: No module named 'gi'
Traceback (most recent call last):
  File "/mnt/c/Users/nnggu/TabNextCloud/Python/ExxoPython/Journal_Coding/./sound.py", line 6, in <module>
    playsound('clock.mp3')
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 254, in <lambda>
    playsound = lambda sound, block = True: _playsoundAnotherPython('/usr/bin/python3', sound, block, macOS = False)
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 229, in _playsoundAnotherPython
    t.join()
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 218, in join
    raise self.exc
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 211, in run
    self.ret = self._target(*self._args, **self._kwargs)
  File "/home/nguw/.local/lib/python3.9/site-packages/playsound.py", line 226, in <lambda>
    t = PropogatingThread(target = lambda: check_call([otherPython, playsoundPath, _handlePathOSX(sound) if macOS else sound]))
  File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/nguw/.local/lib/python3.9/site-packages/playsound.py', 'clock.mp3']' returned non-zero exit status 1.

2

Answers


  1. Wsl sound system till now has issues but you can try installing pulseAudio atleast it worked for me when i was getting choppy audio output. It fixed it but the sound was rather delayed sudo apt install pulseaudio -y and sudo apt install pavucontrol -y(optional if you want the gui)

    Login or Signup to reply.
  2. And by looking at you errors you need to install pygobject and which should solve the missing module error.Use pip to install it

    pip install pygobject
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search