I can not get a variable

OS Win10
PsychoPy version probably 2020.2.4
Standard Standalone

I can get to variable in code component the number of the attempt, and show it in text component message = '% .0f' %(trials.thisN) or feedback on reaction time message = '% .3f' %(key_resp.rt)

But it is not possible to get other variables in the same way, for example, the time of the text appearance message = '% .3f' %(text.started) or joystick coordinates message = '% .3f' %(joystick.x) Psychopy crashes, as if it cannot find a variable, although the variables exist. what could be the problem here?

I There, this is because %.3f means you are trying to access a float variable, but text.started is not a float try just using print(text.started) instead if you are checking out what variables appear like :slight_smile: and if you want to know what type they are use print(type(text.started))

Thank you, Becca. I’m not sure, that I did correctly, I tryed message = print(text.started) , but without result. Where do I need to use print(text.started) ?
My variables look like here


I got variable in code component

I use $message in text component

Becca is just suggesting temporary code for you to use while testing and debugging - not the final code. So just type exactly what she suggested, without trying to store the result of the print() statement in the message variable.

The print() statement will give you output in the Runner window that lets you see what your various variables contain, so that you can then fix your code accordingly.

Please always provide the whole content of the error messages you receive rather than try to interpret them for us – it makes it much easier to help if we have all of the information.

PsychoPy don’t really crashes, just quit without any actions or error reports. message = 'text.started and message = 'joystick.x also don’t work

what happens if you type only


print(type(text.started))

In your code component - nothing else at all.

If you get an error message please copy and paste that whole message. If you don’t get any error messages it is possible you are running a previous version of psychopy that had trouble doing this - please upgrade to the most recent version, type the code recommended above and then share anything in your stdout window with us here.

Thanks :slight_smile: