obeezzy / lpminimk3

Python API for the Launchpad Mini MK3
https://pypi.org/project/lpminimk3/
MIT License
25 stars 2 forks source link

This issue cropped up for me in MacOS 13.3.1 using python 3.9. #124

Closed yatesdr closed 1 year ago

yatesdr commented 1 year ago
          This issue cropped up for me in MacOS 13.3.1 using python 3.9, and python 3.10

Same issue as previously closed #95, solved by extending the exception as noted below to include Darwin.

See: https://github.com/obeezzy/lpminimk3/issues/95

Creating new issue as it does not seem to be limited to Windows at this time, and it's not clear why this is making a problem in MacOS to me.

Error showed as below: Traceback (most recent call last): File "test.py", line 8, in lp.open() File "/opt/homebrew/lib/python3.9/site-packages/lpminimk3/_lpminimk3.py", line 49, in open self._midi_client.open(interface) File "/opt/homebrew/lib/python3.9/site-packages/lpminimk3/_core/utils.py", line 481, in open self.midi_in_port.open() File "/opt/homebrew/lib/python3.9/site-packages/lpminimk3/_core/utils.py", line 197, in open self._midi_in.set_client_name(MidiPort.DEFAULT_CLIENT_NAME) File "src/_rtmidi.pyx", line 686, in rtmidi._rtmidi.MidiBase.set_client_name NotImplementedError: API backend does not support changing the client name.

Using CoreMIDI and otherwise a pretty generic setup.

Fully commenting out lines 186, 187, 196, and 197 in utils.py fixed this issue, and it appears to function normally with that fix applied. It also works by modifying the exception to include 'Darwin'. If you're testing on Linux, it may be the only platform that directly supports renaming the Midi outputs, and I'd see if it makes sense to simply not do this at all to avoid bugs on other OS's.

If it's necessary for Linux, then a proposed fix would be to simply also apply the exception to Darwin as below. This is confirmed working in MacOS 13.3.1

if platform.system() not in ['Windows', 'Darwin']: ....

Edit:

I cloned the project to make this fix and issue a PR, but found it was already done. For some reason pip is using an older version when installing. I'm not an expert in pip but perhaps there's a way to address that?

Will leave open for a couple days to see if pip's repo can be updated to include this fix that was issued in 2022. It may be related to the latest "release" 0.5.0 (May, 2022) being prior to the Darwin fix (Aug 2022).

Originally posted by @yatesdr in https://github.com/obeezzy/lpminimk3/issues/95#issuecomment-1501344959