0

I am trying to play an mp3 file, but cannot, because I get this error when trying to run pygame.init()

The code below works, but gives an error message (video system not initialized).

from gtts import gTTS
import pygame


t = str(input('Texto: '))
tts = gTTS(text=t, lang='pt-br')
tts.save('test.mp3')


pygame.mixer.init()
pygame.mixer.music.load('test.mp3')
pygame.mixer.music.play()
pygame.event.wait()

The code below doesn't run and gives an error message (Module 'pygame' has no 'init' member):

from gtts import gTTS
import pygame


t = str(input('Texto: '))
tts = gTTS(text=t, lang='pt-br')
tts.save('test.mp3')


pygame.init()
pygame.mixer.music.load('test.mp3')
pygame.mixer.music.play()
pygame.event.wait()

How do I solve this issue?

zabop
  • 5,493
  • 3
  • 23
  • 56
  • 2
    Please translate your whole question into english... – zypro Mar 23 '20 at 11:28
  • 1
    Google says this is Português, you can go to https://pt.stackoverflow.com/ where people will be more conformable understating the language. – Sahil Mar 23 '20 at 11:28
  • What development environment are you using and how did you install pygame? This [question](https://stackoverflow.com/questions/50569453/why-does-it-say-that-module-pygame-has-no-init-member) has several answers to your specific error running `pygame.init()` that might help you. – import random Mar 23 '20 at 21:06

0 Answers0