URL of experiment:
Description of the problem:
I copied a version of the experiment that used to work in the past and I had to restructure some routines.
In the Before experiment that of a routine that initializes files with some images in the beginning, I have the following:
import random, xlrd
import numpy as np
# randomize the seed
# dot counting stimulus list
infile = 'stimulus_list/image_names.xlsx'
# one_back stimulus list
one_back_file = 'stimulus_list/Routine_1_Data.xlsx'
# two_back stimulus list
two_back_file = 'stimulus_list/Routine_2_Data.xlsx'
# three_back stimulus list
three_back_file = 'stimulus_list/Routine_3_Data.xlsx'
This translates to the js file perfectly. However, I get the following error message:
I checked online and all the files are in the “stimulus_list” sub-folder.
This is how the JS code looks like:
Try putting it in Begin Experiment instead of Before.
I assume you know that those imports won’t work online.
I tried changing it to “Begin Experiment” and it still doesn’t work.
I get the same error.
Any other idea?
@wakecarter I’ve tried re-doing the project, changing "'" to “/”, changing from piloting to not active and vice versa and still I have the same error.
Any idea on why this doesn’t work?
It worked in the past.
Would this have something to do with the fact that it’s a Save as from the previous experiment that worked?
In your Builder code components is there still a tab somewhere that says Syntax Error Fix Python code?
Use Auto translate code components wherever possible. If you need to add something just for Python or JS then switch it to Py, JS or Both.
There isn’t any error for Syntax Error Fix Python code in the code component that defines “infile”.
There was for an eye-tracking component, but I disabled that component and I re-compiled.
I also have components that are only Py.
But if the components that are with errors or only “Py” are defined after I define “infile”, then it shouldn’t matter, as “infile” is defined before.
I still get the same error.
I managed to solve this by commenting all lines - I won’t use that part in the online experiment anymore.
Okay – though it’s definitely possible to use code link this if you put it on the Python side of an Auto translate code component. It may lead to a resource not found error if you haven’t added the spreadsheets via Experiment Settings / Online or a Resource Manager component, but that’s a different error.