Audio feedback playing every time, not just on incorrect trials

Please help! Thank you in advance.

OS (e.g. Win10): macOS Monterey version 12.6
PsychoPy version (e.g. 1.84.x): v2021.2.3 (due to TouchBar error)
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:

  1. I need my audio to play only if participants incorrectly identify the direction of a dot pattern on the screen. I have the correct answer in my trails.xlsx and Psychopy logs trials as incorrect or correct properly. However, it plays the audio after each trial, incorrect or correct. I have this code at “Begin Routine” at the audio routine.
    if L_R.corr == 0:
    vol=0.5
    else:
    vol=0

I am getting this error, which I am not sure is related:
57.9784 WARNING Got keycode {} but that code isn’t yet known
57.9784 WARNING Keypress was given unknown key code (234)
58.2347 WARNING Got keycode {} but that code isn’t yet known
58.2348 WARNING Keypress was given unknown key code (234)
58.4637 WARNING Got keycode {} but that code isn’t yet known
58.4638 WARNING Keypress was given unknown key code (234)
2022-10-11 13:12:41.072 python[26445:2403123] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/89/4s3qp9x92h79kff104cw0j300000gn/T/org.opensciencetools.psychopy.savedState
2022-10-11 13:12:49.700 python[26445:2403123] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x7ff62e77c1f0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-10-11 13:12:49.701 python[26445:2403123] Warning: Expected min height of view: (<NSButton: 0x7ff62e797520>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-10-11 13:12:49.702 python[26445:2403123] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x7ff62e797e10>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-10-11 13:12:49.703 python[26445:2403123] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x7ff62e79a310>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
Traceback (most recent call last):
File “/Users/stephaniewert/Documents/Documents - Stephanie\u2019s MacBook Pro/UCLA/Lab/statLDM/statLDM_lastrun.py”, line 683, in
depth=-1.0,
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/movie3.py”, line 137, in init
self.loadMovie(self.filename)
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/movie3.py”, line 225, in loadMovie
if os.path.isfile(filename):
File “genericpath.pyc”, line 30, in isfile
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Experiment ended.

What did you try to make it work?:
I have no idea how to change this. After this, the experiment also quit about 10 trials in.

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

Hello,

if L_R.corr:
    vol = 0
else:
   vol = 0.5

should work.

You should put that code in the Begin routine tab of your feedback routine which has to follow your reaction routine.

Perhaps you simplify your experiment such that you can identify was causes the warnings and the error which ends your experiment?

Best wishes Jens