I'm trying to build a Python mp3 player and can't get over this error, any help is really appreciated. Here is my code: from tkinter import * from tkinter import filedialog import pygame.mixer as mixer import os mixer.init() root = Tk() root.geometry("700x220") root.title("Mp3 Player") root.resizable(0, 0) def play_song(song_name: StringVar, songs_list: Listbox, status: StringVar): song_name.set(songs_list.get(ACTIVE)) mixer.music.load(songs_list.get(ACTIVE)) mixer.music.play() status.set("MP3 PLAYING") def stop_song(status: StringVar): mixer.music.stop() status.set("MP3 STOPPED") def load(listbox): os.chdir(filedialog.askdirectory(title="mp3 directory")) tracks = os.listdir() for track in tracks: listbox.insert(END,tracks) def pause_song(status: StringVar): mixer.music.pause() status.set("MP3 PAUSE") def resume_song(status: StringVar): mixer.music.unpause() status.set("MP3 RESUMED") song_frame = LabelFrame(root, text="current song", bg="LightBlue", width=400, height=80) song_frame.place(x=0, y=0) button_frame = LabelFrame(root, text="Control Buttons", bg="Turquoise", width=400, height=120) button_frame.place(y=80) listbox_frame= LabelFrame(root, text="Playlist") listbox_frame.place(x=400, y=0, height=200, width=300) current_song=StringVar(root, value="<Not Selected>") song_status= StringVar(root, value="<Not Available>") #playlist box playlist = Listbox(listbox_frame, font=('Helvectica', 11), selectbackground="Gold") scroll_bar = Scrollbar(listbox_frame, orient=VERTICAL) scroll_bar.pack(side=RIGHT, fill=BOTH) playlist.config(yscrollcommand=scroll_bar.set) playlist.pack(fill=BOTH, padx=5, pady=5) Label(song_frame,text="CURRENTLY PLAYING: ", bg="Lightblue", font= ("Times", 10, "bold")).place(x=5, y=20) song_lbl= Label(song_frame, textvariable=current_song, bg="Goldenrod", font=("Times", 12), width=25) song_lbl.place(x=150, y=20) pause_btn = Button(button_frame, text="Pause", bg="Aqua", font=("Georgia", 13), width=7, command=lambda: pause_song(song_status)) pause_btn.place(x=15, y=10) stop_btn= Button(button_frame, text="Stop", bg="Aqua", font=("Georgia", 13), width=7, command=lambda: stop_song(song_status)) stop_btn.place(x=105, y=10) play_btn=Button(button_frame,text="Play", bg="Aqua", font=("Georgia", 13), width=7, command=lambda: play_song(current_song,playlist,song_status)) play_btn.place(x=195, y=10) resume_btn= Button(button_frame, text="Resume", bg="Aqua", font=("Georgia", 13), width=7, command=lambda: resume_song(song_status)) resume_btn.place(x=285, y=10) load_btn=Button(button_frame, text="Load Directory", bg="Aqua", font=("Georgia", 13), width=35, command=lambda: load(playlist)) load_btn.place(x=10, y=55) Label(root, textvariable=song_status, bg="SteelBlue", font=("Time", 9), justify=LEFT).pack(side=BOTTOM, fill=X) root.update() root.mainloop() This is the error I got: ~/practice/JavaScript$ /bin/python3 /home/raven/practice/python/mp3.py pygame 2.5.2 (SDL 2.30.0, Python 3.12.3) Hello from the pygame community. https://www.pygame.org/contribute.html Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.12/tkinter/__init__.py", line 1967, in __call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "/home/raven/practice/python/mp3.py", line 72, in play_btn=Button(button_frame,text="Play",bg="Aqua",font=("Georgia",13),width=7,command=lambda: play_song(current_song,playlist,song_status)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/raven/practice/python/mp3.py", line 16, in play_song mixer.music.load(songs_list.get(ACTIVE)) pygame.error: not a file object Continue reading...