Dollar sign in text box crashes Psychopy

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Ubuntu 20.04
PsychoPy version (e.g. 1.84.x): PsychoPy3, version 2021.2.3 (c)Jonathan Peirce 2018, GNU GPL license
Standard Standalone? (y/n) If not then what?: virtual environment
What are you trying to achieve?:
Assign variable to textbox in a text component: e.g., $some_text_to_display_depending_on_language_setting

What did you try to make it work?:
tried to enter the name of a str variable with a dollar sign prepended at the beginning

What specifically went wrong when you tried that?:
Psychopy crashed showing me this error message.

Traceback (most recent call last):
File “/path/to/my/home/directory/psychopy/lib/python3.8/site-packages/psychopy/app/builder/dialogs/”, line 29, in validate
validate(self, self.valType)
File “/path/to/my/home/directory/psychopy/lib/python3.8/site-packages/psychopy/app/builder/dialogs/”, line 442, in validate
val = str(obj.GetValue())
RecursionError: maximum recursion depth exceeded while calling a Python object

This is probably a bug but I am not entirely sure. Perhaps there is a reason why variables are not allowed in text boxes?

Please could you paste exactly what you wrote?


My “minimal reproducible example” would be this:

  • Launch PsychoPy environment by typing “source psychopy/bin/activate”

  • Start PsychoPy by typing “psychopy”. The GUI comes up now showing an empty routine named “trial”.

  • Click on the “Text” component in the right-hand panel.

  • Select first cursor position in the text box and hit “$”.

  • This gives me the error shown above.


Sorry – I don’t have any experience with running PsychoPy in virtual environments.

I seem to remember a similar bug cropping up and being fixed in a version since 2021.2.3; the error is essentially that the code which checks for dollar signs calls the function within itself under some very specific conditions so ends up in an infinite loop, which wx (the Python package which the PsychoPy app interface is built on) terminates after a set limit.

If you update to the latest version (2022.1.3 at time of writing) does the error persist?