Python pygame.midi.Input试图使midi2vjoy正常工作时导致分段错误
miditest.pyPython pygame.midi.Input试图使midi2vjoy正常工作时导致分段错误,python,pygame,midi,Python,Pygame,Midi,miditest.py import sys, os, time, traceback import ctypes import pygame.midi import winreg pygame.midi.init() try: print(pygame.midi.get_device_info(1)) m = pygame.midi.Input(1) print('Device opened for testing. Use ctrl-c to quit.')
import sys, os, time, traceback
import ctypes
import pygame.midi
import winreg
pygame.midi.init()
try:
print(pygame.midi.get_device_info(1))
m = pygame.midi.Input(1)
print('Device opened for testing. Use ctrl-c to quit.')
while True:
while m.poll():
print(m.read(1))
time.sleep(0.1)
except:
m.close()
pygame.midi.quit()
这是的代码的一部分,用于测试midi输入,以便以后配置。线路
m = pygame.midi.Input(1)
导致输出
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
(b'MMSystem', b'DDJ-200', 1, 0, 0)
Fatal Python error: (pygame parachute) Segmentation Fault
Python runtime state: initialized
Current thread 0x00003b98 (most recent call first):
File "D:\Python\Python38\lib\site-packages\pygame\midi.py", line 280 in __init__
File "miditest.py", line 9 in <module>
我注意到您正在使用python 3.8和pygame 1.9.6。升级到pygame 2.0.0.dev6,使用
pip安装pygame==2.0.0.dev6
。也许这与这个特定的错误无关,但我认为值得一试,因为我在这个版本组合中也遇到了一些错误,更新到这个pygame版本就解决了它。@kaktus_car实际上解决了这个问题,非常感谢它这么做!不客气。@kaktuz_car您应该添加它作为下面的答案:),也为我解决了它!
self._input = _pypm.Input(device_id, buffer_size)