TaylorSMarks / playsound

Pure Python, cross platform, single function module with no dependencies for playing sounds.
Other
523 stars 115 forks source link

Attempting to use on Rasberry Pi 3: ValueError: Namespace Gst not available #16

Open seanspotatobusiness opened 6 years ago

seanspotatobusiness commented 6 years ago

I have a Rasberry Pi 3 running Raspbian GNU/Linux 9 (stretch).

I get the following error after installing playsound and trying to test following the instructions here: https://pypi.org/project/playsound/

pi@raspberrypi:~/Desktop $ python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    playsound('./Desktop/DEFCON level change.mp3')
  File "/home/pi/.local/lib/python2.7/site-packages/playsound.py", line 92, in _playsoundNix
    gi.require_version('Gst', '1.0')
  File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 118, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gst not available
pi@raspberrypi:~/Desktop $ 
TaylorSMarks commented 6 years ago

I also have a Pi 3 running Raspian. I’d be happy to test and accept any pull requests to fix it.

(I’m not a very good BDFL.)

Taylor

On May 12, 2018, at 11:51, seanspotatobusiness notifications@github.com wrote:

I have a Rasberry Pi 3 running Raspbian GNU/Linux 9 (stretch).

I get the following error after installing playsound and trying to test following the instructions here: https://pypi.org/project/playsound/

pi@raspberrypi:/Desktop $ python test.py Traceback (most recent call last): File "test.py", line 2, in playsound('./Desktop/DEFCON level change.mp3') File "/home/pi/.local/lib/python2.7/site-packages/playsound.py", line 92, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python2.7/dist-packages/gi/init.py", line 118, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Gst not available pi@raspberrypi:/Desktop $

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

omi10859 commented 5 years ago

any update i'm still getting the same error?

paramda-zz commented 5 years ago

Testing on Raspberry Pi 3 B+ model and have just 2 lines in py code. Python version 3.5.3

from playsound import playsound playsound("alarm.wav")

I get error below even after installing packages "gst-make", "gstreamer-player", "fisspy" and "pgi" on Thonny IDE. Any help will be truly appreciated. If there is an alternate package for sound to be emitted that would work as well. Thanks in advance!

Traceback (most recent call last): File "sound.py", line 3, in <module> playsound("home/pi/alarm.wav") File "/home/pi/.local/lib/python3.5/site-packages/playsound.py", line 92, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python3/dist-packages/gi/__init__.py", line 118, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Gst not available

paramda-zz commented 5 years ago

@TaylorSMarks , after going through several posts, looks like playsound doesn't work on Raspbian. Found working code at https://raspberrypi.stackexchange.com/questions/7088/playing-audio-files-with-python

import pygame pygame.mixer.init() pygame.mixer.music.load("myFile.wav") pygame.mixer.music.play() while pygame.mixer.music.get_busy() == True: continue

Any timeline for fixing playsound? :) I like the simplicity aspect.

Vexxlol commented 4 years ago

Any working solutions yet?

I have a pi 4 and getting the same thing... I really wanna use playsound.

File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/playsound.py", line 92, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python2.7/dist-packages/gi/init.py", line 129, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Gst not available

vovantamvn commented 4 years ago

I use pi 3 and get wrong

gsilvan commented 4 years ago

GStreamer Python bindings are missing. Install them by either:

TaylorSMarks commented 4 years ago

If it’s often that easy to fix, it should be made to display a message saying to do so, or it should just automatically take care of it.

Alternatively, can playsound’s linux portion be made to do whatever GStreamer’s Python bindings do, if there’s just some small part needed from it?

Sent from my iPhone

On Jul 14, 2020, at 09:34, gsilvan notifications@github.com wrote:

 GStreamer Python bindings are missing. Install them by either:

Python 2: sudo apt install python-gst-1.0 Python 3: sudo apt install python3-gst-1.0 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

TruncatedDinoSour commented 3 years ago

Fixed for me after installing gst-python, though now it freezes lmao

Lito-Frito commented 2 years ago

Fixed for me after installing gst-python, though now it freezes lmao

Did you ever figure out a fix around the freezing? I tried installing gst-python and it didn't fix the sound issue, but now my program freezes haha.

yangshengtian commented 4 months ago

GStreamer Python bindings are missing. Install them by either:

* **Python 2:** `sudo apt install python-gst-1.0`

* **Python 3:** `sudo apt install python3-gst-1.0`

It seems that, at least for Python 3, we only need to run sudo apt install gir1.2-gstreamer-1.0