Feedback after trial block

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):

Hello,

I am trying to elicit feedback after a trial block. When the participant responds correctly or incorrectly, he should get a “correct” or “incorrect” message.

I have tried to copy the code from the stroop.extended file in the PsychoPy Demos folder, as it also provides feedback to the a practice trial block.

I have created a code component in the feedback identical to the one in the stroop.extended file (and adapted to the current experiment).

When I open this in the coder view (to see what is going wrong), I have seen the following difference in the lastrun.py files:

Stroop.extended:

# Initialize components for Routine "feedback"
feedbackClock = core.Clock()
#msg variable just needs some value at start
msg=''
feedback_2 = visual.TextStim(win=win, name='feedback_2',
    text='default text',
    font='Arial',
    pos=[0, 0], height=0.1, wrapWidth=None, ori=0, 
    color=[1,1,1], colorSpace='rgb', opacity=1,
    depth=-1.0);

Mine:

# Initialize components for Routine "feedback"
feedbackClock = core.Clock()
#msg variable just needs some value at start
msg=''
write = visual.TextStim(win=win, name='write',
    text=msg,
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1,
    depth=-1.0);

When I changed the different part, I still received this error:

Running: /Users/aneicardoisasa/Desktop/Encliticos/encliticos_lastrun.py

pyo version 0.8.0 (uses single precision)
34.3129 ERROR Requested audio device ‘auto’ that is not available on this hardware. The ‘audioDevice’ preference should be one of [‘Built-in Output’]
2018-04-04 21:22:41.496 python[17211:4636318] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/8r/pgnd7v4x2_ndbt508ks_lj_r0000gn/T/org.psychopy.PsychoPy2.savedState
/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/text.py:275: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if text == self.text:
Traceback (most recent call last):
File “/Users/aneicardoisasa/Desktop/Encliticos/encliticos_lastrun.py”, line 333, in
write.setText(msg)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/text.py”, line 289, in setText
setAttribute(self, ‘text’, text, log)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/tools/attributetools.py”, line 137, in setAttribute
setattr(self, attrib, value)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/tools/attributetools.py”, line 27, in set
newValue = self.func(obj, value)
File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/text.py”, line 278, in text
self.dict[‘text’] = unicode(text)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc2 in position 0: ordinal not in range(128)

Could somebody help?
Thanks!

All done, thanks for letting me know!

What we actually need to see is the code you are using to create your msg variable, and how you apply it. i.e. please show us the contents in each tab of your code component.

Please find the psyexp file attachedencliticos.psyexp (25.1 KB)
as well.

Your code looks fine, except that the last msg = ... line has to be indented by the same amount as the ones above (i.e. by four spaces, not two).

I think the issue lies elsewhere. I can’t get your Builder file to compile to a .py script. The only thing I can see that looks strange are the values in your “encliticospractice.xlsx” file (there don’t seem to be the right number of cells in the second column). Can you post your conditions files here?

Also, there might be issues with non-ASCII characters. Could you try making each of your strings explicitly Unicode, by inserting a u prefix:

msg = u'¡Correcto!'

Thank you, I will look into that! Here is the the file: encliticospractice.xlsx (31.0 KB)

It looks to me as if somehow your Builder .psyexp file has become corrupted. What I would suggest is that you create a new, empty Builder file, then, one at a time, copy the routines from the original into the new one (this can be done from the Experiment menu). After each one is added, try to run or compile the experiment. See if that helps isolate any problem. It may, however, be sufficient to fix the problem. Leave in adding the loops until last.

No, this is not a usual situation.

It works now! I copied the feedback routine from the stoop.extended demo and changed it into the feedback message I wanted to give. Thank you so much!