Win10
PsychoPy version 2020.1.1
Standard Standalone
I’m following the guide in the book to embed the conditions information into the HDF5 file output from an eyetracking experiment (page 277-278), but I’m getting an error. I’ve messed around with it for a bit but can’t figure it out and I wonder if this was something that no longer works with the latest psychopy since the book is from 2018?
The problem seems to be with the line io.addTrialHandlerRecord(thisTrial.values())
. Here is the error output (note I printed out thisTrial.values()
in my experiment code so it’s in this output):
## Running: C:\Users\L\Google Drive\PhD\experiment\phase_1.1_lastrun.py ##
7774.4442 EXP Imported design_1_phase_1.xlsx as conditions, 1 conditions, 2 params
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
odict_values([1, 1, 11, image34', 'image211', 'image206', 'image153', 3, 4, 1, 2, 1, 's', 3.5, 0.2, 0.2, -0.2, -0.2, -0.2, -0.2, 0.2, 0.2, 0.2])
1.0603 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'pyo', 'pygame'] (in that order).
ioHub Server Process Completed With Code: 0
Traceback (most recent call last):
File "C:\Users\L\Google Drive\PhD\experiment\phase_1.1_lastrun.py", line 452, in <module>
io.addTrialHandlerRecord(thisTrial.values())
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\iohub\client\__init__.py", line 651, in addTrialHandlerRecord
data.append(cv_row[cv_name])
TypeError: 'odict_values' object is not subscriptable
C:\Program Files\PsychoPy3\lib\site-packages\numpy\core\records.py:854: FutureWarning: fromrecords expected a list of tuples, may have received a list of lists instead. In the future that will raise an error
return fromrecords(obj, dtype=dtype, shape=shape, **kwds)
##### Experiment ended. #####
So I casted the input as tuple with io.addTrialHandlerRecord(tuple(thisTrial.values())
and the experiment ran, but then I still got the following warning, so it’s still not right:
C:\Program Files\PsychoPy3\lib\site-packages\numpy\core\records.py:854: FutureWarning: fromrecords expected a list of tuples, may have received a list of lists instead. In the future that will raise an error
return fromrecords(obj, dtype=dtype, shape=shape, **kwds)
##### Experiment ended. #####
It feels like it’s going to be a simple fix but I can’t seem to get it.