[an error occurred while processing this directive] [an error occurred while processing this directive]

pythonでmidi

きらきら星
import pygame
import pygame.midi

INSTRUMENT = 1  # 楽器の種類 (0-127)
FPS = 60
NOTE_CENTER = 60

score = [0,0,7,7,9,9,7,None,5,5,4,4,2,2,0,None]

def main():
    pygame.init()
    pygame.midi.init()
    midiout = pygame.midi.Output(pygame.midi.get_default_output_id())
    midiout.set_instrument(INSTRUMENT)
    clock = pygame.time.Clock()
    for n in score:
        if n is not None:
            noteno = NOTE_CENTER + n
            midiout.note_on(noteno, 100)
        for i in range(30):
            clock.tick(FPS)
        if n is not None:
            midiout.note_off(noteno, 0)
    pygame.quit()

main()
[an error occurred while processing this directive]