Cedrus button box component calling on non-existent attributes in the pyxid2 python package

OS (e.g. Win10): MacOs 13.3.1
PsychoPy version (e.g. 1.84.x): 2023.2.1
Standard Standalone? (y/n) If not then what?: Y

Hi everyone,

I have been attempting to use a Cedrus Riponda model E with PsychoPy. I have the ftd2xx drivers installed and am able to interface with the response pad using the pyxid2 package in the Psychopy coder. However, when I attempt to use the Cedrus component in Builder, I am given the following error message:

File "/Users/x/Library/CloudStorage/x/Psychopy Experiments/CedrusTests/testing_lastrun.py", line 538, in run
    trials.addData('buttonBox.duration', buttonBox.duration)
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.8/pyxid2/pyxid_impl.py", line 434, in __getattr__
    return getattr(self._impl, attrname)
AttributeError: 'NoneType' object has no attribute 'duration'

It seems to me that the issue lies in PsychoPy calling on the pyxid2 package to log the duration of the Cedrus component. This issue is not solved no matter the actual duration of the component in builder. Additionally, deselecting “Save onset/offset times” in the data tab of the component properties view does not solve it.

I’ve fixed the issue by modifying the pyxid2 package to hard-code in an arbitrary response to this request from PsychoPy:

def __getattr__(self, attrname):
    if attrname == "duration":
        return 1
    else:
        return getattr(self._impl, attrname)

While this is functional, it is obviously not optimal to have to modify the package itself. Are there other solutions to this issue? I would imagine the best way about it is to stop PsychoPy from attempting to log the duration at all since it isn’t needed for the experiment but I haven’t been able to figure out how to do this.

Thank you for any advice!

Gavin

The pyxid2 library was missing support for Cedrus’ new Riponda response pads.

It has now been updated and is available via PyPI and GitHub. The update also includes support for the new voice key feature in Riponda.

riponda-model-l

1 Like

I am using psychopy v2024.1.4 with pyxid2 v1.0.6 and v0.0.4 psychopy-cedrus trying to work with a simple trigger from a lumina box LSC-400B and this fix works. Hard-coding the attribute “duration” seems to be the only way to properly get it to run. I am fairly new to psychopy so I am unsure if this will cause any kind of issue in the future. I would be great to have a more permanent fix.