[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Midi Crashes on Error



Python: 2.7.4
PyGame: 1.9.1release
OS: Ubuntu 13.04

Problem:
Any call to the pygame.midi functions which cause PortMidi to return an error, will cause the entire program to exit (at the C level; no exceptions reach Python).  In the PortMidi interface code, "pm_errmsg" calls prompt_and_exit.  This appears to be because PM_CHECK_ERRORS is defined.  I don't believe it should be.  Not defining it will cause the interface code to return the error codes back to Python, instead of just printing and exiting.

Suggested Solution:
Do not define PM_CHECK_ERRORS.

Reproduction:
# There must be an input midi device at index 1
# This will cause the porgram to exit immediately, no Exception.
import pygame, pygame.midi

pygame.init ()
pygame.midi.init ()

inp = pygame.midi.Input (1)
inp2 = pygame.midi.Input (1)

~William