Setting component during ISI results in TypeError

System: Windows 7, PsychoPy v1.90.2 Standalone.
UPDATE: The same issue occurs on Mac OS X High Sierra.

Hi all,

I am building an experiment with movie-stimuli. For accuracy, I would like to load these stimuli during a static interval (during which only a static/constant fixation cross is displayed). This ISI is currently within the same routine, although I would like to have it in a separate routine as I would like to send an EEG trigger at the stimulus-onset (but one step at the time). The experiment works fine whenever I remove all references towards ISI. However, when I try to set the stimulus during the ISI, it won’t run - or indeed generate the script, so I can’t check there.

So, instead of setting my Movie file ($file; referring to a column header in my conditions list) in the Movie component to set every repeat, I change it to “set during: trial.ISI” (with trial being the highly original name of my routine). This results in:

TypeError: string argument without an encoding

I attached the screenshot of the python prompt for reference, with my routine in the background. Sorry for not being able to copy-paste the text from the prompt. So, for some reason Psychopy has issues with the byte-conversion of the component-name, but I am in the dark of why this happens. The brute force commands (thisSelectVid["file"]).encode()) or $bytes([thisSelectVid["file"]])in the Movie field does not do anything. But then again, the specific error is not related to the stimulus itself but the compName of the static interval. Does anyone have an idea?

(I don’t mean to talk to myself, but…)

I don’t have my experiment here at the moment, but I’m wondering whether going into the lib and changing

prms = self.exp.getComponentFromName(bytes(compName)).params

to

prms = self.exp.getComponentFromName(bytes(compName, "utf-8")).params

would do the trick. As far as I can tell Python 3.6 needs more specificity for encoding a bytes object.

Hi @Cesco, it appears that even if you correct the problem by supplying bytes with an encoding, another problem occurs because when self.exp.getComponentFromName is passed a byte string from Python 3, it does not find the component in the routine, and returns a NoneType object, and the experiment fails. If you will continue using Py3, swap bytes for str, and your experiment should run. I can put in a pull request to fix the error across versions of python.