markusschloesser / MackieC4_P3

A Mackie C4 Midi Remote Script for Ableton 11
20 stars 2 forks source link

AttributeError in dsplayParams branch #35

Closed markusschloesser closed 3 years ago

markusschloesser commented 3 years ago

@BilldarBagdar https://github.com/markusschloesser/MackieC4_P3/blob/8cb639f41e4cbbd2f73a81af09f0f05360e9e82e/wip/MackieC4/EncoderController.py#L1102 this throws me:

RemoteScriptError:   File "C:\ProgramData\Ableton\Live 11 Beta\Resources\MIDI Remote Scripts\MackieC4\MackieC4.py", line 187, in update_display
RemoteScriptError: c.on_update_display_timer()
RemoteScriptError:   File "C:\ProgramData\Ableton\Live 11 Beta\Resources\MIDI Remote Scripts\MackieC4\EncoderController.py", line 1102, in on_update_display_timer
RemoteScriptError: text_for_display = next(x for x in self.__display_parameters if (x.filter_index(t)))
RemoteScriptError:   File "C:\ProgramData\Ableton\Live 11 Beta\Resources\MIDI Remote Scripts\MackieC4\EncoderController.py", line 1102, in <genexpr>
RemoteScriptError: text_for_display = next(x for x in self.__display_parameters if (x.filter_index(t)))
RemoteScriptError: AttributeError
RemoteScriptError: 'tuple' object has no attribute 'filter_index'

First only a couple of errors, but at one point it started vomiting 🤢 I don't know why Live thinks that, I thought you had kicked out the tuple, looked at it for 45min, can't fix it, sorry

BilldarBagdar commented 3 years ago

Weird, I see that line at 1076 not 1102. (Oh yeah I removed a bunch of comments in my local today) It's the line between try and except, right? If so, You can add AttributeError to the exception handler. Do a "Find" on the word 'except' in the EncoderController class. There are 4 other examples, one shows syntax for expecting more than one kind of possible error condition like this. Then you should see ZZZ in the display instead of barf in the logs (from this problem).

next() is a built-in Python way to return the "next item" in the list that matches the filter condition. x is supposed to be an instance of the EncoderDisplaySegment class from the display_parameters list and filter_index() is a method of EncoderDisplaySegment, no tuples should be going into this list any more. Always these EncoderDisplaySegment class objects. You could also work backward and see where there is a tuple getting appended to the display_parameters list. I'll check around more myself tomorrow.

Generally, this change and similar changes should have happened everywhere already, but I could have missed (or don't have all your local changes):

from: vpot_display_text = (' Play ', ' Song ') to: vpot_display_text.set_text(' Play ', ' Song ')

because this has also happened: vpot_display_text = EncoderDisplaySegment(self, s_index)

BilldarBagdar commented 3 years ago

lol, just now followed the link. yep Line 936

I pushed an update to the branch, The issue should be resolved now. I don't think I had a plain midi track in my test session. I also removed all of the breadcrumb "commented out" code in this commit. It's still there in the repo history if we ever need it, but the dead code has been removed from the HEAD.

markusschloesser commented 3 years ago

looks good! I will merge to main, if you don't object in the next couple of hours :-)