PyGame: Unable to open file
Question: I'm trying some basic examples from the [Making Games with Python &
Pygame](https://inventwithpython.com/makinggames.pdf) book, but I'm facing a
weird problem. Here is the example source:

    
    
    import pygame, time
    
    soundObj = pygame.mixer.Sound('beep.wav')
    soundObj.play()
    time.sleep(1) # wait and let the sound play for 1 second
    soundObj.stop()
    

This source produces the following error:

> Traceback (most recent call last): File
> "C:/Users/Thiago/PycharmProjects/PyGame/Sound/app.py", line 3, in soundObj =
> pygame.mixer.Sound('beep.wav') pygame.error: Unable to open file 'beep.wav'

The _beep.wav_ file is properly saved on the same folder of my Python script.
I've tried the `os.listdir()` command and it returns the wav file. Is there
any issue, known bug or am I doing something wrong?

Here is my environment:

  * Windows 10 64 bits
  * Python 3.4
  * Pygame 1.9


Answer: You have to initialize the module or all of the pygame first. There is an
pygame_init() initializer that is going to help you with that. You can find it
[here](http://www.pygame.org/docs/ref/pygame.html#pygame.init)

