Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pygame混音器“;致命Python错误:(pygame降落伞)分段错误“;错误_Python_Pygame - Fatal编程技术网

Pygame混音器“;致命Python错误:(pygame降落伞)分段错误“;错误

Pygame混音器“;致命Python错误:(pygame降落伞)分段错误“;错误,python,pygame,Python,Pygame,榜样 from pygame import mixer import threading import time def sound(file_path): mixer.init() mixer.music.load(file_path) mixer.music.play() while mixer.music.get_busy(): time.sleep(0.1) mixer.stop() mixer.quit() while

榜样

from pygame import mixer
import threading
import time

def sound(file_path):
    mixer.init()
    mixer.music.load(file_path)
    mixer.music.play()
    while mixer.music.get_busy():
        time.sleep(0.1)
    mixer.stop()
    mixer.quit()

while True:
    file_path = input("Enter your file path:")
    threading.Thread(target=sound,args={file_path}).start()
有时,当我运行此代码时,会出现以下错误:

致命Python错误:(pygame降落伞)分段错误


这里出了什么问题?

我猜您试图加载的声音文件不兼容。可能文件中有一瞬间的损坏(或类似的损坏)
pygame.mixer.music
无法处理,但无法从中恢复。您能否提供指向演示此问题的声音文件的链接?这可能值得在PyGame2上进行测试,如果问题仍然存在,则需要编写错误报告。