Possible bug - Builder crashes when typing a dollar sign into a text component

OS : Ubuntu 20.04
PsychoPy version: 2021.2.2
Standard Standalone

What happens:
When I type a dollar sign ($) at the beginning of a text component, Builder gives an error and crashes.
If I type the $ at a different position in the box, nothing happens (please, see the gif below):

Builder_crash_with_dollar_sign

Error message:

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

It happens in a new file - I just have to start Builder and insert a text component.
The same was not happening with the previous version of Psychopy (same OS and machine).

I’m available to run diagnostics.

Cheers!
Flavio

Thanks for flagging! - just tested on windows and can’t replicate - maybe ubuntu specific? but does look like a bug would you be ok to put this as an issue on github so the dev team can test it?

Thanks!
Becca

Hi Becca!

Done :slightly_smiling_face:

Here is the link, in case someone comes looking for this.

Best,
Flavio

I can confirm that this happens on the latest PsychoPy on Manjaro (i.e. Arch-based distro) as well. I think that may mean this happens on all Linux systems. The error message suggest that some recursive function in the program simply repeats infinitely, but I’ll keep looking for solutions.

Dear all!
I found the same “bug” running in Ubuntu 20.04, inside an environment.
I really appreciate any contribution.
Best wishes!

Are you using the latest version of PsychoPy (2021.2.3)?

There does seem to be a similar bug here:

Yes, my friend! I’m using the recent version.
When I use the dollar sign in any text area, as in random variables in sense to create aleatory reading, the builder closes Psychopy.
I have no idea what happens.

Dear all,
I noticed the dollar sign is used as a delimiter to code in text fields, inside Psychopy.
However, the same sign maybe interpreted as an illegal mark by Python interpreter in the recent version, as in the example in Python:

fred$ = ‘alex’
SyntaxError: invalid syntax

I really not use this above syntax, otherwise, the properly $text to text variable in the text fields.
I tried to install older versions, within and without virtual environments, and the same crash appears again. I use Ubuntu 20.04 with Psychopy 2021.2.3.

Dear all,
I personally resolve this task once creating the experiment in the builder, insert the variables in the text field with space before, and, modified the variables directly in Python code, removing the dollar sign.
The experiment runs perfectly.

I believe our resident Linux user @mdc has fixed this for the next release :slight_smile:

1 Like

I am having the same problem. Cannot figure out how to manage with it.

Hi @Airt78

Which version of Psychopy and OS are you using?

Unfortunately I have to check when I’ll comme back to lab. But the funny thing is that before we fixed a computer isuue, it worked great.

By the way, may I just ask how you managed to fix the problem?

Let’s say you are using Ubuntu (or some other Linux distribution) and an older version of Psychopy (the current version is 2022.1.4).

Psychopy 2022.1.4 does not have this issue. Thus, if that is an option to you, consider upgrading.
I’ve written a tutorial on how to install Psychopy 2022.1.4 in Ubuntu 22.04 using virtualenv that might help.

Nevertheless, if you choose to stay with the same Psychopy version (again, assuming that this is your case), you can modify the contents of the file paramCtrls.py (usually installed under home/user/.local/lib/python3.8/site-packages/psychopy/app/builder/dialogs/paramCtrls.py). The modification needed is described here.

If you are not familiarized with the notation used there: the signs indicate one line to delete (-) and two lines to insert (+), with one of them commented (# in the beginning of the line). Save the file and you are good to go :wink:

Please, post here if you manage to solve the problem you’ve been having.

Best regards,
Flavio

Thank you so much for your detailed answer. I’ll text you on Monday and I’ll let you know about some details.

Have a nice weekend

The version that I am using is v2022.2.4. Do you think I can follow your suggestion as well? I can add that the OS is kubuntu 20.04

Hi @Airt78

Thanks for posting the version of Psychopy you are using.
I upgraded my installation to version 2022.2.4 and was able to replicate the error you are experiencing (Psychopy crashes) in my Ubuntu 22.04. So, somehow, this bug found its way back :wink:

Well, the paramsCtrl.py file is different in this version (compared to the one I pointed you to above) but the error, apparently, has the same culprit.

The good news is that I could get rid of it by commenting lines 56 to 66.
The print below shows how my paramsCtrl.py file looks like now:

Although it solves the problem, it is not an elegant / proper solution, but a workaround. @Becca, could you, please, notify someone who could take a look at this?

@Airt78, please, let me know if you can stop PsychoPy from crashing using this workaround.

Best regards,
Flavio

1 Like

Thank you so much, @bastosfh . So the thing that I should do is just to comment to the file of paramsCtrl.py, shouldn’t I? May I ask how you opened this file on Ubuntu? Did you use the command prompt?

Yes, you just need to edit and save the file using any text editor.

You can do this via terminal or using your file manager (I believe Kubuntu uses Dolphin by default).

Using the terminal, you can open paramsCtrl.py using any text editor (gedit, kate, etc.), as long as you know the path to the file (i.e. its location). If you know where your Psychopy files are, paramCtrls.py can be found under /lib/python3.8/site-packages/psychopy/app/builder/dialogs/paramCtrls.py

So, for instance, you can open paramCtrls.py using gedit by typing in the terminal:

gedit path_to_your_psychopy_instalation/lib/python3.8/site-packages/psychopy/app/builder/dialogs/paramCtrls.py

But, if you prefer, you can also locate paramCtrls.py using Dolphin (or Nautilus / Gnome Files) and open it with your text editor (e.g. kate or gedit).

Best regards,
Flavio