I have simple player with wx.ListCtrl as playlist. I first Load List through open file dialog. I populate a dictionary with filenames (populated in Playlist) as keys with their path as values. When I press play, the onPlay method calls onSetPath method which looks up for selected file from list and Loads it path to wx.media.MediaCtrl and then it plays file.

The List Loads fine and onSetPath Loads the path but cannot play the file. Any correction on where I mess up?? Below is the code for mentioned method (Full code is little huge)

#Load File paths
    def onLoad(self, evt):
        dlg = wx.FileDialog(self, message = "Choose Media File to Open", defaultDir = os.getcwd(), defaultFile = "", wildcard = "Media Files|*.mp3;*.wma; *.avi; *.au;*.mpg", style = wx.FD_OPEN| wx.CHANGE_DIR |wx.FD_MULTIPLE)
        ret = dlg.ShowModal()
        if ret == wx.ID_OK:
            self.paths = dlg.GetPaths()
#Loads playList to the List box with name, Format, directory
    def onLoadPlaylist(self, paths):
        #get list of directories with file names eg c:\steve.mp3
        file_list_paths = paths 
        file_list = []
        file_path = dict() #hold filename_ext as keyword and path as value and can be compared to selected file in playlist and get its path as value
        for path in file_list_paths : 
            directory, filename_and_ext = os.path.split(path)            
            full_tuple = (filename_and_ext, directory, "" )
            file_path[filename_and_ext] = path
        #Insert values in Col and Rows
        for i in file_list:
            index = self.playlist.InsertStringItem(sys.maxint, i[0])
            self.playlist.SetStringItem(index, 1, i[1])
            self.playlist.SetStringItem(index, 2, i[2])
        # Make dictionary the attribute of the class
        self.file_path = file_path
# Get selected from list and set it 
    def onSetPath(self):
        index1 = self.playlist.GetFirstSelected() 
        filename = self.playlist.GetItemText(index1)     
        path = self.file_path[filename]
        self.path = path
        return self.player.Load(self.path)
#play it
    def onPlay(self, evt):
        self.slider.SetRange(0, self.player.Length())
        volume = str(self.player.GetVolume())
        self.label.SetLabel("Vol: %s" %(volume,))
This question has already been answered. Start a new discussion instead.