[LAD] mididings Python woes; workaround or fix?

Patric Schmitz bzk0711 at aol.com
Tue Feb 1 11:07:59 CET 2022


Hi Jonathan,

> I was using its Python3 AUR adaptation (mididings-git) under Manjaro, but then after package upgrades, it began to fail at 'from mididings import *' (see below).

The problem is that mididings in no longer compatible with the latest 
Python version (3.10) that you are using. Looking at the GitHub 
repository, the source has not received any update since 2015.

It seems the `Callable()` type has moved from the `collections` module 
to the `collections.abc` (Abstract Base Classes for Containers) quite a 
while ago around Python 3.3.
> https://docs.python.org/3.10/library/collections.abc.html#module-collections.abc

This will be easily fixable by changing line 16 of mididings/arguments.py to

import collections.abc

and changing line 160 to

     elif isinstance(c, collections.abc.Callable):

Of course after you fix it, other errors might or might not crop up. But 
maybe it's worth a try.

It seems that there are a number of forks on GitHub, because the project 
has been abandoned by the original author around 2015, but other people 
are supposedly maintaining bug fixes like this one, or potentially 
developing the library further. So you could look over the forked repos 
here, find out which one is most active/up-to-date and try using their 
fork instead.

> https://github.com/dsacre/mididings/network/members

If you are using the AUR one easy way to try that out would be to edit 
the PKGBUILD file of the mididings-git AUR package and change the 
'source=' line to refer to the respective git repo.

Best regards,
Patric

On 1/31/22 13:39, Jonathan E. Brickman wrote:
> Mididings may be the only JACK-api MIDI router/filter tool around; if 
> there is another I'd love to know about it.  On the other hand t was 
> working just dandy until, I think, some changes to both Python3 and 
> legacy support for Python2.    I found similar 
> failures in Ubuntu 20, and found different failures in both when I tried 
> setting up to use Python2 (which obviously we would rather not be 
> doing).  The failure is similar to a number of failures reported 
> starting with Python 3.10, so this may be related, but I was not able to 
> figure out how to apply those workarounds to the mididings source, I 
> tried several different variations, including a number of the different 
> forks in github.
> 
> Thoughts, anyone?  I found Pigiron and Jamrouter and puredata, but none 
> of these appear to do JACK.  I'm using pipewire now, so I could 
> theoretically revise the whole rig around ALSA MIDI, but all of the apps 
> needing MIDI use JACK, and mididings is so elegant...
> 
> J.E.B.
> 
> 
> |[jeb at newbnr ~]$ python Python 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 
> 11.1.0] on linux Type "help", "copyright", "credits" or "license" for 
> more information. >>> from mididings import * Traceback (most recent 
> call last): File "<stdin>", line 1, in <module> File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10- 
> linux-x86_64.egg/mididings/__init__.py", line 15, in <module> from 
> mididings.engine import run, process_file File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/engine.py", 
> line 15, in <module> import mididings.patch as _patch File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10- 
> linux-x86_64.egg/mididings/patch.py", line 15, in <module> import 
> mididings.units as _units File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/units/__init__.py", 
> line 14, in <module> from mididings.units.engine import * File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/units/engine.py", 
> line 55, in <module> def SceneSwitch(number=_constants.EVENT_PROGRAM): 
> File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/unitrepr.py", 
> line 46, in composed return arguments.accept(*constraints, **kwargs) 
> (store(f)) File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/arguments.py", 
> line 49, in __init__ self.constraints = [_make_constraint(c) for c in 
> constraints] File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/arguments.py", 
> line 49, in <listcomp> self.constraints = [_make_constraint(c) for c in 
> constraints] File 
> "/usr/lib/python3.10/site-packages/mididings-2.0.0+r26a40db-py3.10-linux-x86_64.egg/mididings/arguments.py", 
> line 160, in _make_constraint elif isinstance(c, collections.Callable): 
> AttributeError: module 'collections' has no attribute 'Callable' >>>|
> 
> 
> 
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev at lists.linuxaudio.org
> https://lists.linuxaudio.org/listinfo/linux-audio-dev


More information about the Linux-audio-dev mailing list