Hi everyone,
Sorry for the double-post; I overlooked the new forum link in the old Google group page. I’m new to PsychoPy and Python, and I’ve been having an issue with filenames in Builder. Basically, I’ve been trying to create a simple visual search experiment. I’ve created a separate .py file in Coder that randomizes stimuli and locations, and holds various image filenames in string variables (I double-checked with print and the code works). In Builder view, I import the .py file at the start of the Trial routine with a Code Component. (I’ve also tried just posting all of the code from the .py file in the Code Component.)
Within each trial, I’ve added a series of “placeholder” images. However, for each placeholder image, when I try to define my filenames with string variables in the “Properties” menu next to “Image”, I always get a “Couldn’t find image file” error. I’ve tried a variety of formats, e.g., Resources/target, “Resources/”+=target, etc., where “Resources” is the relative path to the folder and “target” is an example string variable holding a filename. I’ve found a lot of answers to similar issues regarding filenames in Builder, but all seem to suggest either explicitly defining the path or referencing a .csv. I’m familiar with defining image files in a similar way in E-Prime, but maybe this is a feature that Builder doesn’t have? Any help is greatly appreciated!
Thanks,
Steve
System:
OSX 1.11.5
PsychoPy 1.83.04, Standalone
Here’s the full error:
3.3523 ERROR Couldn't find image file '"Resources/"+target'; check path?
2016-08-07 10:47:44.431 python[6373:852261] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/2k/x2jwcbj10_d4nvggs451003w0000gn/T/org.psychopy.PsychoPy2.savedState
Traceback (most recent call last):
File "/Users/Steve/Dropbox/Research and Course Files/Software/PsychoPy Stuff/Visual Search Sample/visualsearch_lastrun.py", line 508, in <module>
image_17.setImage(u'"Resources/"+target')
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/image.py", line 261, in setImage
setAttribute(self, 'image', value, log)
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/tools/attributetools.py", line 100, in setAttribute
setattr(self, attrib, value) # set attribute, calling attributeSetter if it exists
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/tools/attributetools.py", line 20, in __set__
newValue = self.func(obj, value)
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/image.py", line 249, in image
maskParams=self.maskParams, forcePOW2=False)
File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/visual/basevisual.py", line 647, in _createTexture
% (tex, os.path.abspath(tex))#ensure we quit
OSError: Couldn't find image file '"Resources/"+target'; check path? (tried: /Users/Steve/Dropbox/Research and Course Files/Software/PsychoPy Stuff/Visual Search Sample/"Resources/"+target)