Can't access from spreadsheet

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

OS (Mac OS 14.5):
PsychoPy version (2024.1.1):
**Standard Standalone? (y):
**What are you trying to achieve?: read a variable from a spreadsheet for use in an image or a text component located within a trial loop. Not only won’t my own code work, but the same failure happens even with standard Psychopy demo experiments

**What did you try to make it work?: updated python, updated Psychopy, made sure Psychopy had full disc access, turned off VPN

*What specifically went wrong when you tried that?: in the excel spreadsheet, the column with names of the variable I’m trying to access is stdImage. I’m accessing it in routine as $stdImage. Here’s the error code (last part of it); 6.1475 EXP Imported ConditionsFile.xlsx as conditions, 5 conditions, 4 params
6.1487 EXP Created sequence: fullRandom, trialTypes=5, nReps=1, seed=None
6.1489 EXP New trial (rep=0, index=0): {‘stdImage’: ‘images/IMG_1.png’, ‘compImage1’: ‘images/IMG_1.png’, ‘compImage2’: ‘images/IMG_9.png’, ‘compImage3’: ‘images/IMG_31.png’}
6.1555 EXP image: autoDraw = False
6.1555 EXP image: autoDraw = False
6.1555 EXP text: autoDraw = True
7.1512 EXP window1: mouseVisible = True
1.2524 WARNING Monitor specification not found. Creating a temporary one…
File “/Users/sekuler/Desktop/vSTMexpt/vSTMexptBeta_Good2GoBob_lastrun.py”, line 1874, in
run(
File “/Users/sekuler/Desktop/vSTMexpt/vSTMexptBeta_Good2GoBob_lastrun.py”, line 1096, in run
standardImage.setImage(stdImage)
NameError: name ‘stdImage’ is not defined
ioHub Server Process Completed With Code: 0
################# Experiment ended with exit code 1 [pid:2001] #################

The problem IS that I am running on Apple hardware. When I run the same code on an older, Intel based Mac, no problem. For some reason, on Apple hardware (M1 or M2), Psychopy3 misinterprets a variable like $stdStim as stdStim and crashes.

1 Like

Please could you show where you’re using stdImage?

$ defines that a section should be interpreted as code, not that something is a variable. In many cases you don’t need a $ and I’m sure there are cases where you get an error if you use more than one.

My conditions file (an .xlsx sheet) has a column, headed “sdtImage”, that contains the names and paths for the image I want to present. I tell the routine to use that conditions file, and then, within the routine I pass $stdImage to the image component. Works fine on an Intel-based Mac, but not on a Mac with M1 or M2 processor. I have confimed this on three different Intel-based Macs and, although it was overkill, on three different M-series Macs.

Guess I wasn’t clear. I use ghe vatiable name preceded by a dollar sign as the pointer to images image contained in a spreadsheet. The name with the dollar sign is the bane if the column that holds the pointers to the images.