psychopy.org | Reference | Downloads | Github

Hello World text appears rather than Stimuli in Pavlovia

URL of experiment: https://run.pavlovia.org/Meltem/stroop/?__pilotToken=6f4922f45568161a8cdf4ad2299f6d23&__oauthToken=ae06298762f7b4abe0ded39a8c0fed59eb4bfa8391f917f94231f49439f5ffdc

OS: Mac Mojave Version 10.14.6
PsychoPy version: v2020.2.3
Standalone: not sure about this one

Gitlab link: https://gitlab.pavlovia.org/Meltem/stroop
My project is public so you can view it and my code using this link.

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!

I’m having a similar issue. I get hello word text even when I type some dummy text in and set the component to a constant.

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.

Yes that’s what I ended up doing. Doesn’t really make sense.

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.

console.log(yourVariable);

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.

Thanks for the advice!

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.

Is anyone else still having this issue?

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.
img1 img2
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).
Screenshot 2021-01-27 at 11.16.59
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.
Screenshot 2021-01-27 at 11.16.44
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).

2 Likes

Thank you so very much for the in-depth example! Who knew that the excel files could wreak so much havoc on our studies?!?!

1 Like

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