Python code not translated properly into JS, "fillColor" undefined

Hello everyone,
I have a question about my task. I’ve uploaded it to Pavlovia, errors keep coming up. I’ve managed to fix one of them, but I don’t know what the problem with the the TypeError: Cannot set property ‘fillColor’ of undefined . By looking at the console, it says that the error is in line 1923, but it doesn’t make sense to me what is has to do with “fillColor”


Also, I can see the other errors highlighted, line 1797.
image

Can anyone tell me what I should do about the fillColor error and why it says that the error is in line 1923?
Thank you!

The error isn’t telling you about an issue with fillColor. The issue is that the object you are trying to edit is undefined.

Thank you for the reply,

I used polygons in psychopy, i don’t know why they are not defined, do you have any recommendations on how to fix this error?

Please could you show the polygon and the offending code?

Hello,

these are the polygons I’ve created within psychopy


all the names are included in the code, I don’t understand what can be undefined.


Hope this is the code you were asking for.

They don’t seem to be called currBlock_3

Hello, could you look at this error please. I don’t know what I should change?



Thank you

You are referencing numpy, which doesn’t work online.

Please take a look at my crib sheet for help with what is likely to work and how to fix the bits that don’t.

Thank you!
I’ve looked at the crib sheet and it says I cannot use numpty but to remove all references to it. To clarify, does that mean I should erase line 1, and if I do, do I have to add something that I should add to ensure it runs smoothly without this line?


You need to find other ways of achieving what you want in Python.

For example

durations = []
for Idx in range (41):
     durations.append(.4+.05*Idx)

For append to work you will need Polyfill or append = push in code_JS