Python command in text component gets to error in Pavlovia?

URL of experiment: https://run.pavlovia.org/lizfortuna/tgame13/html/?__pilotToken=98f13708210194c475687be6106a3b84&__oauthToken=c986d6d00548e148b06444c5106a8970ffc4056ce16da47c85358acc0e46dc0d

Description of the problem:
This experiment works fine in psychopy, in local computer. I want to put it online through Pavlovia. It begins well, but the problem arises when the participant clicks on the slider and then the program ends with an error - it shouldn’t end there.

I think the problem happens in the routine following the slider. In such routine, there is a text component with the command: “$u"O favorecido decidiu COMPARTILHAR o valor passado a ele por você. Com isso, você possui " + str((10 - rating_exemplo_6.getRating()) + (2 * rating_exemplo_6.getRating())) + u” PONTOS no total."

So the command in this text component should get the imput of the slider of the previous routine and then exhibit a new number. But it just crashes when in pavlovia. Works fine in psychopy.

Error message:
Unfortunately we encountered the following error:

  • ReferenceError: str is not defined

Try to run the experiment again. If the error persists, contact the experiment designer.

If necessary, I may share more information. Thanks in advance!

For Pavlovia all Python code needs to be in code blocks for the auto translate to work.

Thank you for your reply!

How can I do that? If I write in a code component, it can be auto translated to javascript for pavlovia?

Yes. Have you tried?