Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Python PlaySound No module named 'gi'

when I request using "playsound" library for Python to play the audio file .mp3 it returns me the following error:

Code:

import playsound

playsound.playsound("test.mp3")

Error:

Traceback (most recent call last):
  File "/home/enzoportela/PycharmProjects/SoftwareRover2018.2/SoftRover/I.A Rover(2018.2).py", line 25, in <module>
    playsound.playsound("test.mp3")
  File "/home/enzoportela/anaconda3/envs/SoftwareRover2018.2/lib/python3.6      /site-packages/playsound.py", line 91, in _playsoundNix
    import gi
ModuleNotFoundError: No module named 'gi'
like image 446
RoktSe Avatar asked Nov 18 '18 20:11

RoktSe


People also ask

How do I install Python Playsound?

https://pypi.python.org/pypi/playsound/1.2.1 - link for playsound module it is very easy to download. You can download it using pip by navigating with cmd to your python folder (usualy C:\Users\UserName\AppData\Local\Programs\Python\Python35-32) and writing: python -m pip install playsound (if you are using python 3).

Is Playsound a module?

The playsound module is a cross platform module that can play audio files. This doesn't have any dependencies, simply install with pip in your virtualenv and run! Implementation is different on platforms. It uses windll.

How do I turn off audio in Playsound module?

After successful execution of the program, audio file will start playing. Now Click on terminal, once you see the cursor, type Ctrl+C , it will bring you out of the terminal and audio will also stop playing.


1 Answers

The most simple way is the vext approach.

pip install vext
pip install vext.gi

Reference: How do I install python3-gi within virtualenv?

like image 146
D Hudson Avatar answered Sep 29 '22 05:09

D Hudson