| Reference | Downloads | Github

TypeError: cannot read property of 'ps1_cond' of undefined (Note: ps1_cond is a column header)

URL of experiment:


Description of the problem: I originally had a working experiment from Psychopy, but it did not upload to pavlovia. I’ve looked at countless threads and learned that none of the libraries worked so I used a shuffle function and an excel reading function that was shared by dvbridges, which finally got my experiment to run. Now I wanted to put each of the elements in a column to separate lists and my code looks as follows:

ps1_cond = [];
gender_cond = [];
connective_cond = [];
ps2_cond = [];
gender_cond2 = [];
descriptive_cond = [];

for (var rowx = 1, _pj_a = (num_items + 1); (rowx < _pj_a); rowx += 1) {

if ((valueX >= 6)) {
} else {


And the error I got is TypeError: cannot read property of ‘ps1_cond’ of undefined. When I changed the ‘ps1_cond’ from the line ps1_cond.push(trialList[rowx][‘ps1_cond’]); to any other word, it will show up with the same error but with the different word. I saw from dvbridges’ code that he put the column headers in that same spot and it worked, so I’m wondering what is wrong on my part.

I’ve also looked at the example experiment wakecarter provided in his google doc, but I am not very confident with python and JS so I didn’t completely understand how to implement that into what I have.

Try undefined in the JS code instead of None.

Sorry, which part of the code are you referring to? The only time I recall using None was in initialize for tempPic and tempSentence (in python) but I don’t think that was what was causing the ps1_cond issue.

Just changed the two variables tempPic and tempSentence to undefined in the JS code, but I’m still getting the same error.

What is trialList ? Where does that come from?

You could try printing it (console log) to get it’s defined when used.