3

I ran the following code:

import pygame
import os

music_file = os.path.join(os.getcwd(), "midi.mid")
print(os.path.exists(music_file))
pygame.mixer.music.load(music_file)

The output is:

True

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-10-cd8bc226cd05> in <module>()
      4 music_file = os.path.join(os.getcwd(), "midi.mid")
      5 print(os.path.exists(music_file))
----> 6 pygame.mixer.music.load(music_file)

error: /etc/timidity.cfg: No such file or directory

Why?Is it a bug of pygame? I want to play midi.

1 Answers1

1

i can solve this issues on the following page, I execute this commands. I hope this can be useful for you.

sudo apt-get install freepats
sudo apt-get install timidity

for more info: https://medium.com/@karthik_ak/pygame-midi-file-issue-on-ubuntu-16-04-2dcfc776ede9

jelambrar
  • 39
  • 3
  • 2
    Please consider adding context for links provided on the answers as well as further explanations on how your answer solves the problem. – vlizana Aug 01 '20 at 23:08