Str.upper() issue with Pavlovia

Having issues with a str not defined. I’ve identified it as being an issue with using .upper() but changing it to .toUpperCase() hasn’t helped.

Here is the Python code.

p1corr = 0

if recall_resp.rt:
    if CorrectAnsR1 in str.upper(Recall_Typed.text):
        p1corr = 1
    else:
        p1corr = 0
else:
    p1corr=0
phase1corr.append(p1corr)
    

Here is the JS code:

var _pj;
function _pj_snippets(container) {
    function in_es6(left, right) {
        if (((right instanceof Array) || ((typeof right) === "string"))) {
            return (right.indexOf(left) > (- 1));
        } else {
            if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
                return right.has(left);
            } else {
                return (left in right);
            }
        }
    }
    container["in_es6"] = in_es6;
    return container;
}
_pj = {};
_pj_snippets(_pj);
p1corr = 0;
if (recall_resp.rt) {
    if (_pj.in_es6(CorrectAnsR1, str.toUpperCase(Recall_Typed.text))) {
        p1corr = 1;
    } else {
        p1corr = 0;
    }
} else {
    p1corr = 0;
}
phase1corr.push(p1corr);

It converts the written answers to upper text to check against correct answers in a typed response

Any help would be great

Your Python syntax is wrong. Try

Recall_Typed.text.upper()

I changed the python code, then switched it back to autoJS, then back to both to change the JS code to “toUpperCase” and that has fixed the issue.

The python code I used initially did end up working in the offline version however.

In the latest version, .upper() will auto translate to .toUpperCase() so a manual translation is no longer needed.