The syntax error means that your code can’t be translated into PsychoJS. I find this useful for spotting simple errors in my Python code. However, if you know why you are getting the syntax error (reverse dictionary lookup) and don’t need it to work online, then don’t worry about it.
PsychoPy apparently does not auto-translate a brute-force approach of a reverse dictionary lookup
my_dict = {"color": "red", "width": 17, "height": 19}
value_to_find = "red"
for key, value in my_dict.items():
if value == value_to_find:
print(f'{key}: {value}')
(taken form here) The above code gives a JavaScript syntax error (auto-translate apparently throws an error on
for key, value in my_dict.items():
So you need a code-component that is set to Both instead of Auto → JS and provide separate lookups-routines on each side. JS-solutions can easily be found.