Piano HAT Midi Issues

Hi there,

I’m trying to get my Piano HAT running the midi-piano.py so that I can link it to Yoshimi.

I can’t get the code to run in either Python 2 or 3. I think I’ve installed everything I need.

If I run it in v2 I get:

Traceback (most recent call last):
File “/home/pi/Pimoroni/pianohat/examples/midi-piano.py”, line 11, in
import midi
File “/home/pi/.local/lib/python2.7/site-packages/midi/init.py”, line 2, in
from .events import *
File “/home/pi/.local/lib/python2.7/site-packages/midi/events.py”, line 27
class AbstractEvent(object,metaclass=AutoRegister):
^
SyntaxError: invalid syntax

But if I run it in v3, it doesn’t find the midi module at all:

Traceback (most recent call last):
File “/home/pi/Pimoroni/pianohat/examples/midi-piano.py”, line 11, in
import midi
ImportError: No module named ‘midi’

So my question is what version of midi / python-midi should I be installing, and then which version of Python should I be running midi-piano.py in?

Thanks alot,
Larry.

Going to have another look at this.

Can anyone confirm that running:

pip install git+https://github.com/vishnubob/python-midi@feature/python3

will install this for Python v3, which should get the import midi working in v3?

Thanks.