Tried to look at your code component but I get the error âValueError: <psychopy.experiment.params.Param object at 0x000001A72345B438> is not in listâ. Perhaps try deleting it and adding it again?
I had a similar issue before when I tried to code in JS. For myself when declaring variables such as frameDur make sure it doesnât have âvarâ before it. This can means its only available within that routine. For example, if you have âvar frameDur = 1000;â in âbegin experimentâ, it will become inaccessible for any following routines. Instead, you can put it directly where its needed in âbegin routineâ.
thanks i sorted that one based on the thread you suggested.
NOTE* for complete newbies - it took me a while to figure out how to even edit the js script because you donât seem to be able to do it using the Edit option, when I clicked âWeb IDEâ it let me edit the script.
on to the next error: ReferenceError: INTROClock is not defined hahahaha!
So, a bit of background about the general issue with this error. Variables in JS have to be defined before use and where that definition is inserted defines their scope. A part of the Builder->JS compile step is to detect the variables and add in their definitions at a global level so that they are accessible throughout the study.
I think the fact that some studies are reporting this (but most are not having the problem) I think is probably a symptom of another problem in the experiment that isnât showing up in a very clear way So Iâm thinking that some part of the study is failing to generate correct JS code (I donât know why and it might well not be your fault) and therefore the second step of finding all the variables is failing.
When you export your HTML/JS code from the study (e.g. with sync) is there no warning/error message showing up I suppose? Sorry, I havenât had a chance to check your experiment myself yet, but the general steps would be trying to simplify the study down until the error goes away so that we can work out which part is the root cause. Once we find the root cause in one or two of these studies we can hopefully add something that traps it and saves other users from the issue
Thanks for this - it seems to want me to define about 20 variables on my own. Iâve been working my way through them fine until I got to one that when I define it in the same way as the others it doesnât work and I get the same error.
Reference Error: Where is not defined.
the attached image shows of all of the variables iâve successfully manually added in the black circle and the one with the red arrow pointed to it doesnât work even though it seems to point to the right variable (i.e., it is highlighted elsewhere in the code when i click it).
Potentially useful information: I have an easier version of the task which works fine, its only the version with the code component which has issues. And iâm using 2020.1
Yes, very important info, and that fits my theory.
Adding those variables is one thing (the symptom) but the true cause is most likely a syntax error in the code component. If the rest of the program were right then they would have been created automatically for you. Most likely something in your python code got auto-translated incorrectly (because that isnât easy to do right!).
Could you upload your CodeComponent in both Python and the translation. Please use 3 backticks ``` to surround the code when you post it so that it keeps the formatting.
Dear all, I have encountered a similar issue. I had previously coded an experiment in Coder (only .py file) and wanted to port it to Pavlovia. As I am not fluent in JS I thought I use a trick to put in a Code Component and then copy-paste some of my .py program code through the Code Component. I managed to push my way through many debugging steps, but ultimately get stuck on ReferenceError messages, including the âframeDurâ reference.
Would it perhaps help if I put much additional code as functions in a separate .py file and import it in the .psyexp experiment? I may still need the Code Component for this, but could put it at the end of the experiment?
@jon â I have the same issue and thought to comb through my code statements.
I suspect this one could be a suspect, since another experiment complains about it directly:
Hi
I am experiencing the same issue and I think its because the experiment needs a xxxxxNoModule.js file.
That file appears to hold the necessary definitions and I suspect a syntax error in my JS script is somehow stopping that file from being generated but honestly I have no real idea.
Is such a file tailored for every script or is there a general template that can be downloaded and edited?
Thanks
Philip.
Ok hands up its nothing to do with xxxxxNoModule.js - my mistake. However, none of the âglobalâ variables get defined in my JS script and my Python code runs fine and it throws no errors or warnings.