I'm trying to create a stand-alone python application (Tic-Tac-Toe) using pyinstaller. I wrote the following commands in the command prompt:
pyinstaller -w --onedir x_and_o.py
pyinstaller --add-data "Sound;snds" x_and_o.py
The .mp3 files are saved in the folder "Sound". Everything was executed 'Successfully' but I'm still getting the following error:
pygame 1.9.6
Hello from the pygame community.
https://www.pygame.org/contribute.html
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter\__init__.py", line 1883, in __call__
File "x_and_o.py", line 216, in <lambda>
File "x_and_o.py", line 30, in changeText
File "x_and_o.py", line 182, in pop
pygame.error: Failed loading libmpg123.dll: The specified
module could not be found.
Here's a snippet from my code:
pygame.mixer.init()
def pop_sound():
pygame.mixer.music.load(r"C:\Users\Dipesh\OneDrive\Desktop\Visual Studio Code\Tic-Tac-Toe Project\Sound\pop.mp3") # r means 'raw string'
pygame.mixer.music.play()
def Air_horn():
pygame.mixer.music.load(r"C:\Users\Dipesh\OneDrive\Desktop\Visual Studio Code\Tic-Tac-Toe Project\Sound\Air horn.mp3") # r means 'raw string'
pygame.mixer.music.play()
def game_over_sound():
pygame.mixer.music.load(r"C:\Users\Dipesh\OneDrive\Desktop\Visual Studio Code\Tic-Tac-Toe
Project\Sound\gameOver.mp3")
pygame.mixer.music.play()
I've tried looking up for solutions online but couldn't find any solution to my problem.
I'm using Windows 10 and coding in VS code.
To solve the following error:
pygame.error: Failed loading libmpg123.dll: The specified
module could not be found.
I simply needed to download this file and move it to my application folder. You can read about libmpg123 here