I'm having trouble with Track FX, when trying to use an FX name as an index, whereby I got a KeyError.
To further investigate, I tried to duplicate the basic example on page
https://python-reapy.readthedocs.io/en/latest/reapy.core.html#reapy.core.FX which is:
Code:
>>> fx_list = track.fxs
>>> fx_list[0]
FX(parent_id="(MediaTrack*)0x0000000006CDEBE0", index=0)
>>> len(fx_list)
1
>>> fx_list["VST: ReaComp (Cockos)"]
FX(parent_id="(MediaTrack*)0x0000000006CDEBE0", index=0)
But my test case fails with:
KeyError: 'No FX named VST: ReaComp (Cockos)'
It was run
outside reaper, on a project that had ReaComp as the only FX on a Selected track:
Code:
import reapy, sys
project = reapy.Project()
x = project.selected_tracks
if len(x) != 1: sys.exit(1)
track = x[0]
fx_list = track.fxs
print("Number of FX is", track.n_fxs)
print(fx_list[0])
print(fx_list[0].name)
print(fx_list["VST: ReaComp (Cockos)"]) # Gets KeyError
And here is the output:
Code:
Number of FX is 1
FX(parent_id="(MediaTrack*)0x00000000049C0EE0", index=0)
VST: ReaComp (Cockos)
Traceback (most recent call last):
File "D:\Work\bug1.py", line 11, in <module>
print(fx_list["VST: ReaComp (Cockos)"]) # Gets KeyError
File "C:\Users\Tom Parker\AppData\Local\Programs\Python\Python38\lib\site-packages\reapy\core\fx\fx.py", line 409, in __getitem__
i = self._get_fx_index(name=i)
File "C:\Users\Tom Parker\AppData\Local\Programs\Python\Python38\lib\site-packages\reapy\core\fx\fx.py", line 434, in _get_fx_index
raise KeyError("No FX named {}".format(name))
KeyError: 'No FX named VST: ReaComp (Cockos)'
I'm running Reaper 5.99/x64, Reapy 0.6.0, and Python 3.8.2.
Thanks for any advice.