Description of the problem: I designed a stroop task in the builder. I have a practice trial and actual task. Everything was working fine offline. Then, I moved task to pavlovia to run it online and I had some errors. I fixed them and now, the experiment begins and practice trial runs perfectly. But then actual task begins, and rather than the color names that were assigned in excel file, âHello Worldâ text appears in all 120 trials. I have no idea where this came from as I didnât write anything like that in my code. I looked up in other threads but couldnât solve it. Could you please help me to solve this? Thank you so much!
Hello, I tried changing csv files to excel (stimilus files) because someone recommended it but it didnât fix my problem. You can try, maybe it helps you. I just deleted everything and synched the code in builder to pavlovia again and the problem disappeared. Unfortunately, I donât know how or why⌠Maybe, it was a glitch in the system.
Any update on this issue? The same thing is happening to my experiment, and it is quite perplexing. I tried deleting the experiment through GitLab and re-uploading from PsychoPy, but the same issue remained.
I think it might have to do with where and how you declare your variables - it could be the case that you declared a variable in one routine and the value canât be accessed in another routine. Try logging the values of your variables in console by using the code below and make sure you put this on more than one place in your code. Then start your experiment and press F12 and on the right hand side you will see a âconsoleâ tab. Make sure youâre checking it as you go through your experiment and see what the value of your variable is and you might be able to spot where the problem happens.
Iâm not entirely sure but it seems to be a problem with how quickly psychopy can update the TextSim. The default âtextâ attributeâs value is âHello Worldâ for some reason.
My temporary fix for solving this issue is by downgrading the visual stim library to 2020.1.js
So replacing
import * as visual from './lib/visual-2020.2.js';
with
import * as visual from './lib/visual-2020.1.js';
In the .js file for my experiment.
This can throw a bunch of compatibility issues though, for example: changing the colour of the textStim throws an error.
Unfortunately, when I use the old version of the visual stim library, my text doesnât show up at all. Iâm still having trouble with this issue. I thought Iâd fixed it, but it keeps happening (more often than not). Sometimes (randomly) my code works as it should. Then, when I rerun the exact same experiment (without changing any code), âHello Worldâ comes back.
Hello again,
Have you tried debugging it with console.log() function? I used it when I had a problem similar to yours. You would need to place the following code console.log(yourVariable); carefully in a few positions throughout your scripts so that you can see exactly when the variable does not have a value (thatâs when you get âhello worldâ displayed).
Yes, Iâve played around quite a bit with the console.log() function. It seems like the problem is with the .setText function (i.e. setting the text to be equal to an entry in an excel file). I donât think itâs an issue with the excel file, because I use the same excel file to set an image (with .setImage) a few lines earlier, and that has always worked perfectly.
Is there something weird about how strings have to be formatted in excel files, perhaps?
I think I (finally) figured it out. I was using the following code to read in my conditions: TrialHandler.importConditions(psychoJS.serverManager, filename, triallist)
Turns out that the triallist argument can be pretty finicky. The following inputs work: '1:3' ['0','2']
But the following inputs DO NOT work: 1:3 '0,2' ['0,2']
I was trying to define the trial list elsewhere in my code, and I had it formatted incorrectly. Making it into an array works, though: var trialsubset = []; trialsubset.push(0); trialsubset.push(2);
And then you can call: TrialHandler.importConditions(psychoJS.serverManager, 'trials.xslx', trialsubset)
So glad you finally figured it out! For those using xlsl file, sometimes an extra space in the column name can cause the problem. For example, you have a file with some words that you want to display, if there is an extra space after your variable name (instead of âWORD 1â you actually have "WORD 1 "), this will make it impossible for Pavlovia to call column âWORD 1â and will lead to âhello worldâ for the value of this column. You can check my example below.
My test contained two options of which one is correct. One of the options was displayed as hello world.
When checking your xlsl file, if you double-click on the cell, you will see if there are any additional spaces in the variable name. Like you can see in the first image, column name âOPTION 1â actually does contains an additional space, while âOPTION 2 does notâ. If left like this, it will cause errors further on.
Now, when you try console.log() on the entire array that you loaded into Pavlovia, you can see that the column name âOPTION 1â is actually different to all other column names (e.g. âOPTION 2â doesnât contain " " and extra space).
If you then try logging the exact value that brings âhello worldâ like in the image above, you will see that there is one undefined value like in the image below. This causes Pavlovia to display âhello worldâ instead of this undefined value.
So itâs always good to check your xlsl files and make sure they are neat. Be extremely careful even if you are opening your excel files just to check something as the same type of error may happen if you are nor careful enough (e.g. clicking on a cell, hitting spacebar and saving the file).
Hello, I am facing a similar error and am trying to use console.log(variable);
however any suggestions on where one should insert this? In my experiment there are nested loops. I have posted my question here as well: Hello world: instead of my intended text