When looping through the images in the condition files the error: "The argument is not an image" appears

https://gitlab.pavlovia.org/Sycheva_Varvara/withoutcolumns.git

Description of the problem:
In this experiment, I have 2 ways of displaying the Image stimuli. The first is through indicating the path in the Image properties and this works. The second is looping and displaying the Images from the Condition file. I had 3 columns in this file: “Images” with the path, “CorrAns” and some others. Everything worked in the Builder but when I tried to run it in Pavlovia the following error displayed:

I thought the reason was that Pavlovia could not separate the columns correctly. So I changed the Conditions file and left just one column with the Images paths. But the error did not disappear:

I don’t understand what is the problem I would be happy to see some advice. I’m a noob in programming, so I would appreciate some simplistic explanation. Thank you!

Excel files seem to work better than csv online

I don’t think ! is a valid character for a filename online.

The condition file is the Excel file. I have deleted the ! everywhere but it didn’t solve the issue.

Hi There,

Looking at your files I think there are still some stray ! characters. Some tips to help.

  1. you can use this script to remove the illegal characters from your filenames (open in psychopy coder and just run)
    file-extension-fix.py (650 Bytes)
  2. Make sure to also remove the exclamations from the excel file (I did find replace and I think there were 5 stray ones)
  3. in the experiment settings > online tab make sure to reload all the images in the “additional resources” section with the new file names.

After this if you encounter resource errors it will most likely be that a filename is listed in the excel sheet that does not exist in the “additional resources” section.

Hope this helps,
Becca

Hi Becca,

I am running into a similar issue. My file names do not have any special characters. I receive a similar error but the code works properly in the builder. Can you please help me work through the error?

Thanks,
Adam

Hi Adam- I don’t think the link is to the specific gitlab repository - please could you reshre the link to your project? here are some docs on how to do that Searching for experiments on Pavlovia — PsychoPy v2021.2

thanks
Becca

Becca,

Sorry about that. But before getting into the repo, I just want to elaborate a bit more on the issue. So I am using .pop to select images, and the experiment works with no errors in both builder and Pavlovia. However, I want to select a random element from my array and .pop only selects the last element in Javascript; .splice is able to extract elements from the middle of an array and I am piping in a random number to select from the array. However, when using .splice, I get the error noted above.

Hi There, if it is that you want to use pop() equivilently in python and javascript is it possible for you to reverse the list you are working through using the .reverse() method then select from the end myList[-1] then use pop myList.pop()?