Forums

playsound module, can it be used here?

I am trying to use the playsound module to play a file in my local director named something like sound.wav Is this even possible on Python Anywhere?

Here is the code:

from playsound import playsound playsound('sound.wav')

Error: Traceback (most recent call last): File "/home/username/.local/lib/python3.8/site-packages/playsound.py", line 261, in <module> playsound(argv[1]) File "/home/username/.local/lib/python3.8/site-packages/playsound.py", line 163, in _playsoundNix gi.require_version('Gst', '1.0') File "/usr/lib/python3.5/site-packages/gi/init.py", line 133, in require_version (namespace, version)) ValueError: Namespace Gst not available for version 1.0 Traceback (most recent call last): File "/home/username/playsound", line 14, in <module> playsound('sound.wav') File "/home/username/.local/lib/python3.8/site-packages/playsound.py", line 254, in <lambda> playsound = lambda sound, block = True: _playsoundAnotherPython('/usr/bin/python3', sound, block, macOS = False) File "/home/username/.local/lib/python3.8/site-packages/playsound.py", line 229, in _playsoundAnotherPython t.join() File "/home/username/.local/lib/python3.8/site-packages/playsound.py", line 218, in join raise self.exc File "/home/username/.local/lib/python3.8/site-packages/playsound.py", line 211, in run self.ret = self._target(self._args, *self._kwargs) File "/home/username/.local/lib/python3.8/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.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/username/.local/lib/python3.8/site-packages/playsound.py', 'sound.wav']' returned non-zero exit status 1.

playsound will not work on PythonAnywhere. There is no sound hardware on our machines and, even if there was, the sound would be played in an Amazon datacentre where you would not be able to hear it.

Ok, thanks, that's what I figured.