Neither an image nor a video error on 2023.2.3 version

URL of experiment: new_try [PsychoPy]

Description of the problem:

Hi, this error message occurs only when I try to take an image from a list.

Under ‘begin experiemnet’: pic_list = [‘1.jpg’]
Under ‘begin routine’: pic = pic_list.pop()
In the image properties: $pic is ‘set to every repeat’.

This works fine locally, but when I upload the experiment to Pavlovia, I get:

2023.2.3.js:1200 | {“origin”:“ImageStim.setImage”,“context”:“when setting the image of ImageStim: image”,“error”:“the argument: 1.jpg is neither an image nor a video" }”}

When I use 1.jpg instead of $pic in image properties and set it to ‘constant’, the picture appears fine online so it’s not a problem with the picture.

Any thoughts?

Check whether your entry for 1.jpg in your ehas a space after it.

Thanks, but that wasn’t the problem.

I was able to figure out what went wrong and it seems to be related to python>js translation in the new version.

In the old version when I wrote in builder:
pic = pic_list.pop() it was translated to js as: pic = pic_list.pop();
However, in the new version 2023.2.3:
pic = pic_list.pop() is now translated to js as: pic = pic_list.splice((- 1), 1);

I changed it manually to pic = pic_list.pop() in the js window and now the experiment runs online.

I’m not sure why the python>js translation changed in the new version, but this was the problem.

I hadn’t noticed the change. It will probably be because.pop() is the same in Python and JS but .pop(0) only works in Python. I’ll create a minimal demo to test.

I’ll notify the team. This issue is that the new splice returns an array instead of a single item.

There are two workarounds:str(pic_list.pop()) and pic_list.pop()[0]

I favour the latter because str will mess up a nested list.

Here’s my demo: pop [PsychoPy]

1 Like

I also get the error “the argument: xyz.jpg is neither an image nor a video" }

@wakecarter: I tried your solutions, but they didn’t work. When I click on your demo, I get the same error :sweat_smile:

I load the images though a csv-file and there are no spaces in it. I also have no variable called “image”.

Do you get the same error when you select one of the two bugfix options in my demo?

My bad! Your demo works! Sorry!

I also got rid of the error! :partying_face: The images are still not shown, but I will hopefully resolve this error too! :sweat_smile: