title: Playing music with pyspotify, what am I missing?
body: <p>Im new to Python and I am trying to make a class where I will play some music with the spotify library pyspotify. I have the code below and I taught that it would be playing music if I run the play method. This does not work because I can't hear any music playing, no error messages appear from what I can see. What do I have to do more?</p>
  
  <pre><code>import spotify
  import threading
  
  class Music:
      session = None
  
      def __init__(self):
          logged_in_event = threading.Event()
  
          def connection_state_listener(session):
              if session.connection.state is spotify.ConnectionState.LOGGED_IN:
                  logged_in_event.set()
  
          self.session = spotify.Session()
          loop = spotify.EventLoop(self.session)
          loop.start()
          self.session.on(
                     spotify.SessionEvent.CONNECTION_STATE_UPDATED,
                     connection_state_listener)
  
          self.session.login('accountname', 'password')
          logged_in_event.wait()
  
          print self.session.connection.state
          print self.session.user
  
      def play(self):
          track = self.session.get_track('spotify:track:2Foc5Q5nqNiosCNqttzHof')
          track.load()
  
          self.session.player.load(track)
          self.session.player.play(play=True)
  </code></pre>
  
  <p>And in another Python file I do:</p>
  
  <pre><code>music = Music.Music()
  music.play()
  </code></pre>