Error in in val2array. ValueError: Invalid parameter. None is not accepted as value

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): v2021.2.3
**Standard Standalone? y
What are you trying to achieve?:
I’m running a fairly simple nested loops setup. The outer loop contains a reference sheet with 5 filenames, in a column called path. The inner loop runs through these ‘path’ conditions. The contents of N-back_1_trial refer to column names in the 5 almost identical files.

The task runs, but crashes at the end of blocks. At a different (unpredictable) block each time though.

What did you try to make it work?:
Several things:

  • unchecking ‘Is trials’ in the outer loop (since these are trial blocks)
  • running with an earlier version of psychoPy (2021.2.2)
  • changing the folder in which everything is stored (I read on here that the file path might be too long)
  • running the whole experiment from the coder view
  • running sequential trials, randomised or full randomised trials for the outer loop (the inner remained sequential)

For each attempt the same error message remained.

What specifically went wrong when you tried that?:

Traceback (most recent call last):
File “C:\Users\white-a\Desktop\SpatialNBack\WMtraining\Stimuli\Nback_stimuli\”, line 529, in
sceneJPG.setPos(location, log=False)
File “C:\Users\white-a\AppData\Local\PsychoPy\lib\site-packages\psychopy\visual\”, line 1648, in setPos
setAttribute(self, ‘pos’, val2array(newPos, False), log, operation)
File “C:\Users\white-a\AppData\Local\PsychoPy\lib\site-packages\psychopy\tools\”, line 178, in val2array
raise ValueError('Invalid parameter. None is not accepted as ’
ValueError: Invalid parameter. None is not accepted as value.

If there are any more suggestions for what I could try, I’d be very grateful!!


1 Like

Hello ajw283,

do mind posting screen-shots of your condition-files or upload the files?

Best wishes Jens

Happy to! Thanks for your response. Here are the files…

I see I’m limited to 5 uploads, but the final file is almost identical to the previous a,b,c,d; only the content of the columns changes, and not the structure.

NBack_1_Master.xlsx (8.5 KB)
N-back-1a.xlsx (9.4 KB)
N-back-1b.xlsx (9.2 KB)
N-back-1c.xlsx (9.3 KB)
N-back-1d.xlsx (9.3 KB)


does your experiment crash when there is only one correct key? What happens if you add a correct key to the currently empty cells? I have never seen (and tried) before to define correct keys this way you do.

Do you provide feedback or have a conditional branching based on the response?

Best wishes Jens


I’ve tried running the experiment with several more changes, and each is giving the same error message as in my first post and crashing at the end of a random block:

  1. change corrAns column values to l, s OR l OR s OR blank
  2. change corrAns column values to l OR s OR blank
  3. change corrAns column values to all contain s
  4. convert all input files to .csv

At this stage I am not providing feedback nor conditional branching based on the response. I intend to add staircasing once this simplified version is running.

I am attaching a zip with my experiment and all required files to run. Could you try to reproduce the error? (additional files in next post)
(edit: files were too large. I have created a redacted version of the experiment with only one image file in place of 110 files. The error still reproduces for me with these files) (563.0 KB)

Thanks so much for your help, I have been going crazy today trying to figure out this error

Spatial-N-back.psyexp (40.5 KB)

Hello ajw283

which PsychoPy-version are you using? I use 2021.2.3 which is the latest version but your script throws a couple of warnings and asks for another version.

Best wishes Jens

Thanks Jens for trying it out. I’m also using 2021.2.3…out of interest, which version is it asking you to use? and what are the warnings? Perhaps if I roll back to that version it will help.


in the demo I downloaded Use PsychoPy version was set to lastest


when setting it to empty


the experiment ran locally. I did not test it online.

Best wishes Jens

Oh man, I was so excited but then it didn’t work for me. The same val2array error appears.

Were you able to run through the five bocks without it crashing?

Do you have any other suggestions about where the val2array error might be coming from?

and a huge thanks for helping me out thus far!

Hi Alice,

When I downloaded your Zip file and opened NBack_1_Master.xlsx I found the cursor was in cell A7 which is empty.

The issue might be that it crashes when it tries to run row 7, which could be solved by moving the cursor and resaving.

Spreadsheet a also has the cursor in empty cells.

Hello Alice,

sorry, :bowing_man: but I did not run the complete experiment. Five repetition times five lists times 30 trials are quite a lot for testing. :wink: The experiment did not start at all. It started when I changed the version-setting to nothing. I looked in most Excel-files and might have edited them such that the cursor was in a non-empty cell.

Now I can get the same error as you are getting. The error seems to to occur always when there is a switch from one list to the next. Still testing.

Best wishes Jens

Thanks @wakecarter and @JensBoelte. I have played around with the files and think it is fixed!!

Leaving the cursor in non-empty cells didn’t change the error message.
After that, I created new xlsx files, importantly, with my PC language set to English (it was in German)… et voila!

It seems that a sneaky piece of punctuation was getting into the corrAns array. This may not have been a problem if psychoPy was looking for european sheets, but I think my psycoPy expects UK sheets. I could be wrong though. At least it is now working!!

The issue was extra blank rows that the experiment thought contained something in spreadsheets a, c & d. I was able to spot them by manually connecting them to the inner loop and seeing that PsychoPy was telling me they had 38 or 31 conditions instead of 30.

N-back-1d.xlsx (8.8 KB)
N-back-1c.xlsx (8.8 KB)
N-back-1a.xlsx (8.9 KB)

1 Like

Hello Alice,

ok, I now ran the experiment twice without problems. I split the location column in two colums (locx, locy)


and changed the location parameter from $location to [locx, locy]. In the result-file there were some rows which contained no location and no image information.


This was in N-back-1a (8 rows) , N-back-1c (1 row), N-back-1d (1 row). So, there was something, invisible, in these rows that led PsychoPy to read these rows. Why it worked when using locx, locy instead of location, I do not know.

BTW, you set the location and the image in every frame. I guess you want to set them in every repeat.

No, it has nothing to do with German or English Excel-sheets. I was using a “German” Excel. In your redoing the Excel-files you deleted the superfluous rows.

Best wishes Jens

1 Like

Thanks both! This makes sense.
Not sure why there were missing rows, nor why I couldn’t see them. But I’m very glad to have this figured out