OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2022.2.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?: display images
I know this sounds like a trivial question, and it often turns out that somebody misspelled the path. However, I truly believe this is really not the case here, and it almost feels like a PsychoPy bug.
For context: I programmed a complex experiment, where the first routine determines the next routines. In my first routine, the participants see faces in particular conditions. In later routines, they read sentences that are accompanied by faces, and the condition of the sentence must match the face that was presented in that same condition earlier.
In a nutshell, I use this code in my first routine:
Begin Experiment
speakerimageCN = []
speakerimageCF = []
speakerimageIN = []
speakerimageIF = []
End Routine
if speaker_cond == 'CAN native':
speakerimageCN = speakerimage
thisExp.addData('speakerimageCN', speakerimageCN)
elif speaker_cond == 'CAN foreign':
speakerimageCF = speakerimage
thisExp.addData('speakerimageCF', speakerimageCF)
elif speaker_cond == 'IMM native':
speakerimageIN = speakerimage
thisExp.addData('speakerimageIN', speakerimageIN)
else:
speakerimageIF = speakerimage
thisExp.addData('speakerimageIF', speakerimageIF)
I know for a fact that that all my variables are properly recorded (because I checked it with " thisExp.addData", I will attach the screenshot of the csv)
Now, in my second routine, I use this code to display images
if speaker_cond == 'CAN native':
speaker_face.setImage('images/' + speakerimageCN + '.jpg')
elif speaker_cond == 'CAN foreign':
speaker_face.setImage('images/'+ speakerimageCF + '.jpg')
elif speaker_cond == 'IMM native':
speaker_face.setImage('images/'+ speakerimageIN + '.jpg')
else:
speaker_face.setImage('images/'+ speakerimageIF + '.jpg')
And each time I reach that part I get this error:
Traceback (most recent call last):
File "G:\My Drive\World knowledge\PsychoPy experiment\WK_LAB - Copy_lastrun.py", line 1428, in <module>
speaker_face.setImage('')
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py", line 416, in setImage
setAttribute(self, 'image', value, log)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py", line 134, in setAttribute
setattr(self, attrib, value)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py", line 27, in __set__
newValue = self.func(obj, value)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py", line 382, in image
self.isLumImage = self._createTexture(
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py", line 1022, in _createTexture
raise IOError(msg % (tex, os.path.abspath(tex)))
**OSError: Couldn't find image ; check path? (tried: G:\My Drive\World knowledge\PsychoPy experiment)**
################ Experiment ended with exit code 1 [pid:28716] #################
I know that the path is correct, I checked it a thousand times. Also, when I make an error in the path on purpose (say, ‘imagess/’+ speakerimageIF + ‘.jpg’) I get a different error:
Traceback (most recent call last):
File "G:\My Drive\World knowledge\PsychoPy experiment\WK_LAB - Copy_lastrun.py", line 1419, in <module>
speaker_face.setImage('imagess/'+ speakerimageCF + '.jpg')
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py", line 416, in setImage
setAttribute(self, 'image', value, log)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py", line 134, in setAttribute
setattr(self, attrib, value)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py", line 27, in __set__
newValue = self.func(obj, value)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py", line 382, in image
self.isLumImage = self._createTexture(
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py", line 1022, in _createTexture
raise IOError(msg % (tex, os.path.abspath(tex)))
**OSError: Couldn't find image imagess/WF1.jpg; check path? (tried: G:\My Drive\World knowledge\PsychoPy experiment\imagess\WF1.jpg)**
################# Experiment ended with exit code 1 [pid:7628] #################
I am really racking my brain here as to why this is happening. It seems like when the path is correct it just doesn’t accept it and crashes??? I would appreciate any help you can offer