简体   繁体   中英

pyinstaller error, exe compilation error?

music player programming. ran into a problem. The program should play the file that I run using my program. For this, I formatted the code in exe. When I started using my exe an error occurred

Traceback (most recent call last):
  File "MP3.py", line 13, in <module>
  File "MP3.py", line 7, in music
pygame.error
[1980] Failed to execute script MP3

MP3.py -my python code/

import pygame 
import sys
f = str(sys.argv[1])
print(f) 
def music(f):
    pygame.init()
    clock = pygame.time.Clock()
    pygame.mixer.music.load(f)
    pygame.mixer.music.play()
    while pygame.mixer.music.get_busy():


pygame.mixer.init(22050,-16,2)
music(f)

various methods do not help. although the code with music playback works shortly and in exe as well as the output of the file that I launch by the program

this error

C:\Users\Acer\Documents\Projects\MP3\Test.mp3

Traceback (most recent call last):
  File "MP3.py", line 15, in <module>
    music(f)
  File "MP3.py", line 9, in music
    pygame.mixer.music.load(f)
pygame.error
[17280] Failed to execute script MP3

You should first use pygame.mixer.init before using mixer to do anything you want. You can refer to this document for details about how to tweak the parameters of the mixer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM