psychopy.org | Reference | Downloads | Github

Modifications done in JS code component in Builder not manifesting in compiled script

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2021.1.2
Standard Standalone? (y/n) If not then what?: Yes
**What are you trying to achieve?:**edit string contents in js code component to changed them to french from english. This is from a downloaded copy of the BART task taken from pavlovia. The original task runs perfectly in the runner, but when the text is modified in the builder the change does not manifest when the modified task is run in the runner.

**What did you try to make it work?: Modified the text in the js code component. Then tried compiling both a new python script and/or a new js script and then trying to run it in the runner. Tried running it with local js debugging mode but the experiment stayed stuck at initializing. The new compiled scripts always contain the original english strings instead of the french. This is not however the case for the strings in a text component. It is only strings contained in js code components that will not update.

**What specifically went wrong when you tried that?: The modified string is visible in the builder, but when the experiment is sent to the runner and launched the experiment runs as if no changes had been made to the code component.

There are no error messages.

Ctrl Shift R in Chrome will flush the cache to run the latest code

Hello @wakecarter ,

Thank you for your quick reply, however I am not trying to run the experiment in a browser. I am trying to run it through the runner in builder. The original version of the experiment (downloaded from Pavlovia) runs perfectly this way in spite of it containing only JS code in the code components. Is there some sort of cache that Builder/Runner keeps that also needs to be cleared, or will clearing the cache in Chrome affect how Builder/Runner works?

Thank you.

I try to write experiments so they work offline as well as online. If you have downloaded an experiment with only JS code (change some components from JS to Both to check), then it probably won’t work offline unless you back translate

@wakecarter Thank you again for your fast reply. This is the link to the task.

The .psyexp file contains only JS code in the code components. The code in these components appears to be essential to the proper functioning of the task. It is my understanding based on the documentation found here:

https://workshops.psychopy.org/3hrs/21codeComponents.html

that if a code component is configured to be JS only, that code will only work online. However the task does work in its original form in the Runner found in Builder. Do you have any idea why this would be, and why changes to the strings in the JS code would not appear when the modified experiment is launched in the runner?

Thank you.

There is Python code in your experiment. Set all the code components to Both so you can see the Python code too.

@wakecarter Thank you, that solves the problem.

Is it necessary to hide the python code before generating the JS code for the web, and/or is it necessary to hide the JS code before generating Python code?

Thank you for your help.

Anthony

No.