Negate problem

80 views
Skip to first unread message

tiz...@gmail.com

unread,
Jul 19, 2012, 6:31:14 PM7/19/12
to midi...@googlegroups.com
In Debian wheezy, with the packaged versin of mididings (20120419), every time I use a negate, in either of the two forms, it says something like:

Traceback (most recent call last):
  File "...../pruebas.py", line 37, in <module>
    ((CtrlFilter(7).negate()) % (Transpose(-12) >> Output(1, 6, program=(128*13, 1), volume=40)))
  File "/usr/lib/python2.7/dist-packages/mididings/units/base.py", line 130, in __mod__
    return self.apply(other)
  File "/usr/lib/python2.7/dist-packages/mididings/units/base.py", line 135, in apply
    self.build_negated(),
  File "/usr/lib/python2.7/dist-packages/mididings/units/base.py", line 206, in build_negated
    return self.negate()
TypeError: 'bool' object is not callable


Any help is appreciated. Thanks.

Dominic Sacré

unread,
Aug 4, 2012, 10:31:30 PM8/4/12
to midi...@googlegroups.com, tiz...@gmail.com
Hi,
Oops...

This error occurs when a negated filter is negated a second time, which
happens internally when using the % operator.

The reason is a name clash between Filter.negate() (which is a function)
and InvertedFilter.negate (which is a boolean). This really is the kind of
error that Python makes way too easy ;)

As a temporary workaround, if you don't feel like messing with the
mididings source, you could just avoid using negated/inverted filters with
operator %.
For example, your patch above can be written like
[ CtrlFilter(7).negate() >> (...), CtrlFilter(7) >> Pass() ]

(This is really all operator % does anyway, it's just a bit of syntactic
sugar).


Cheers,

Dominic

tizo

unread,
Aug 5, 2012, 10:36:42 PM8/5/12
to Dominic Sacré, midi...@googlegroups.com
Thanks Dominic. As for now, I am using the previous version, so I
don't have the problem.

tiz...@gmail.com

unread,
May 31, 2015, 2:59:29 AM5/31/15
to midi...@googlegroups.com, domini...@gmx.de, tiz...@gmail.com

This problem is still happening on mididing packaged version of Debian 8. Can I do something to fix it?. I don't feel like changing all my mididings scripts. Besides, my selectors are not single filters.

Tizo

unread,
Aug 12, 2018, 1:20:19 PM8/12/18
to mididings
Just in case anyone is interested on this, it could be solved in Debian buster installing the package version of the repositories (20120419), and in the file /usr/lib/python2.7/dist-packages/mididings/units/base.py, inside _InvertedFilter class (lines between 209 and 219) change all the variables names of "negate" with "negatevar" or something else.
Reply all
Reply to author
Forward
0 new messages