title: why does pygame mixer can't play song at runtime
body: <p>I have an array of Song class objects that I created and I'm having problem playing music with pygame mixer.</p>
  <p><a href="https://i.stack.imgur.com/gMZmG.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gMZmG.gif" alt="photo" /></a></p>
  <p>as you can see, I have 4 songs in the working directory, I created an array of Songs object which have information about the different song.
  on particular function that I have created is <code>getIndexName()</code> which returns the name of the file.
  the name of the array is <code>songsData</code>.</p>
  <p>If I would call the function:
  <code>mixer.music.load(&quot;song1.mp3)</code> and then <code>mixer.music.play()</code>
  it works fine, however if I would call:
  <code>mixer.music.load(songsData[1].getIndexName())</code> and then <code>mixer.music.play()</code></p>
  <p>I'm getting an error:</p>
  <blockquote>
  <pre><code>mixer.music.load(songsData[1].getIndexName())
  pygame.error: Couldn't open 'song2.mp3
  </code></pre>
  </blockquote>
  <p>I think that I have to determine which file I want to play at compilation time, but I don't know If I think right.
  If I'm right is there any module that can play mp3 files (or wav) and I can determine which file at run-time? (like calling random).</p>
  <p>thanks for youre help!</p>