| Reference | Downloads | Github

Image file path not updated in inner loop

URL of experiment:


Description of the problem:

I’m working on at task that presents various images and asks questions about those images afterwards. The images are presented in an image loop within the trial loop, like so:

Presenting images in the outer loop works as expected, but I cannot present randomly selected images from the conditions file of the inner image loop. It seems that the file path is not being updated in the online version. I’ve manually added a filepath outside of the loop, and the URL is not being updated. However, it seems that the attribute in the inner loop conditions file (imgfile) is read properly. Here’s a snippet from the debugger:

What am I doing wrong here? Is there something that I’m missing?

Some remarks: Image path is set up as TaskImages/FileName.jpg in my csv, and the images are all present in the folder. The Python code isn’t using .draw anywhere. I’ve tried to explicitly set interveningimage.setImage(imgfile) which made things worse. An image path given by the conditions file defined in trialloop to WMprompt is working fine.

PS. I also have a feeling this relates to my post here, which also depends on an inner loop conditions file within the larger trial loop. I haven’t been able to solve that one either and decided to address this issue first.

More things I’ve tried based on other posts on this forum, without avail:

  • Explicitly changing imgfile in an inner loop code component (i.e. imagepath = imgfile, and set $imagepath in the interveningimage component screen)
  • interveningimage.SetImage(imgfile) in a code component at the start of the routine
  • Adding the conditions file containing imgfile paths to the conditions file of outer trial loop
  • Clearing browser cache
  • Deleting, recreating, and resyncing the html folder

Explicitly printing imgfile during an image loop shows that the same image and URL are used over and over. I see that the right attributes are being imported. This gives me the impression that the attributes of the inner loop conditions file are not available in the components of the inner loop, or at least are not being updated. Here are the debugger messages during such a loop:

Any help would be much appreciated.

I finally solved the issue.
I have a JS-code snippet in the first routine of the experiment, similar to the suggestion in Wakefield’s crib sheet. It defines a couple functions en sets a few default values. One of these values is the default image of the loop. Simply removing this default value (the entire line) from the code component resolved my issues.