Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

available_apis() and available_ump_apis() both throw exceptions #137

Open
pissalou opened this issue Feb 10, 2025 · 4 comments
Open

available_apis() and available_ump_apis() both throw exceptions #137

pissalou opened this issue Feb 10, 2025 · 4 comments

Comments

@pissalou
Copy link

Hello Jean-Mickaël,
While poking around with my freshly built python binding, I noticed these two calls throw exceptions. I have tested on both Linux and Windows and it produced the same error:

$ python
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibremidi as lm
>>> lm.available_apis()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: 10 is not a valid API.
>>> lm.available_ump_apis()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: 4101 is not a valid API.
@jcelerier
Copy link
Member

hmm weird, here on linux it gives me:

[API.ALSA_SEQ, API.ALSA_RAW, API.JACK_MIDI, API.PIPEWIRE, API.KEYBOARD, API.DUMMY]

[API.ALSA_SEQ_UMP, API.ALSA_RAW_UMP, API.DUMMY]

@jcelerier
Copy link
Member

That's with python 3.13 though

@jcelerier
Copy link
Member

Also the string "is not a valid API" does not come up anywhere in the codebase.. weird. Are you on current git main ?

@pissalou
Copy link
Author

My fork is fairly recently and I have tested now on python 3.13.2 and got the same error messages. It seems to be related to the network/network (UMP) apis as you can observe under the calls to get_compiled_api_by_name() also fail with the same message respectively. Those two api types are not part of the python binding in pylibremidi.cpp, could it be your python binding was compiled using the LIBREMIDI_NO_NETWORK flag? Could it explain why you don't get the same error?

`$ python
Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb 4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import pylibremidi as lm
lm.available_apis()
Traceback (most recent call last):
File "", line 1, in
lm.available_apis()
~~~~~~~~~~~~~~~~~^^
ValueError: 10 is not a valid API.
lm.available_ump_apis()
Traceback (most recent call last):
File "", line 1, in
lm.available_ump_apis()
~~~~~~~~~~~~~~~~~~~~~^^
ValueError: 4101 is not a valid API.
lm.get_compiled_api_by_name('network')
Traceback (most recent call last):
File "", line 1, in
lm.get_compiled_api_by_name('network')
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
ValueError: 10 is not a valid API.
lm.get_compiled_api_by_name('network (UMP)')
Traceback (most recent call last):
File "", line 1, in
lm.get_compiled_api_by_name('network (UMP)')
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
ValueError: 4101 is not a valid API.
lm.get_compiled_api_by_name('winmm')
API.WINDOWS_MM
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants