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

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

Hello @bastosfh. Thank you so much for your suggestion. I would like to ask if by using the code you have mentioned here, this might be the expected output.

If so, which are the following steps?

No. The empty file indicates that your paramCtrls.py is not in the same path as mine.

Use your file manager to locate the file → right click on it → “open with” kate (or any other text editor you have installed).

Many thanks for replying me back. As far as I can see from the path (whose I am sharing the pic) there is no ‘dist-packages’ folder by following the path where the final one I am looking for is located. I found this ‘dist-packages’ just into with the folder called ‘python’, but once opened, cannot found the rest. Do you think this might depend on some updates? Which would recommend.

Thanks

Hello. I managed to open the file (finally) with Kate. Actually if you had a look to my previous post, the real message that popped up was:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/builder/dialogs/paramCtrls.py", line 31, in validate
    validate(self, self.valType)
  File "/usr/local/lib/python3.8/dist-packages/psychopy/app/builder/dialogs/paramCtrls.py", line 557, in validate
    if re.findall(r"(?<!\\)\"", val):
  File "/usr/lib/python3.8/re.py", line 241, in findall
    return _compile(pattern, flags).findall(string)
  File "/usr/lib/python3.8/re.py", line 291, in _compile

Do you think I should make commented the same lines as you did? I am asking because by commenting those lines, it returns the same error.

1 Like

How did you install Psychopy?
Could you upload here your commented paramsCtrl.py?
What was the issue you fixed (see quote below) and what did you do to fix it?

Would it be possible for you to start fresh (reinstall Kubuntu and Psychopy)?

Hi, the solution by @ bastosfh works. Checked on Kubuntu 20.04, psychopy 2022.2.2. Thank you.

1 Like

Unfortunately, these fixes did not solve the problem for me on Ubuntu 22.04 using PsychoPy 2023.1.1

Hi, @Catherine_Hanson

I’ve never tried this version of PsychoPy.
Nevertheless, I’ve just opened the current paramsCtrl.py on github and, if the bug is caused by the same feature, the workaround would be to comment lines 75 to 85:

Screenshot from 2023-04-12 10-03-53

Please, let me know if that works.

Best regards,
Flavio

Sorry, not sure where that file is located. Looked in home/user/.local/lib/python3.8/site-packages/psychopy/app/builder/dialogs/paramCtrls.py (with my “user”) but it’s not there. I did install Psychopy-2023.1.2.exe on my Ubuntu22.04 machine and ran it under Wine. Seems to run fine (no $var issues), although launching is slow (for splash, dialogs, and start of script) relative to linux. Not sure if that did anything to the .local files, but I doubt it. Still interested in using the linux version though if you have any thoughts of where the paramsCtrl.py file might be located.

Hi @Catherine_Hanson

Unless you are absolutely confident that you are getting reliable timing, I would really advise against using Wine in this case, since the “extra layer” could cause undesired / unpredictable delays. Have you considered installing PsychoPy “directly” on your Ubuntu using this tutorial (or any other you may find)?

About the location of paramsCtrl.py: I’ve never used Wine myself to install Psychopy-2023.1.2.exe, so I don’t know where the .exe installer send it to. Have you tried searching for the file using Nautilus / Files?

I agree about the wine layer. Not my favorite choice, but I’ve got some commitments to deal with.

Yes, actually, I did see your post but didn’t work for me - After 50 million searches and installs I can’t remember what the specific problem was, but it didn’t solve it for me. However, it did motivate my own solution although that was before I ran into the $var problem. I was just happy PsychoPy launched and seemed to be functional.

Apparently, the 2023.1.1.zip and the 2023.1.1.tar.gz files on github extract as 2023.1.1, but the PsychoPy that launches is actually 2022.1.4. Which may have caused the original problems. I’ve now downloaded the 2023.1.2 and that’s the one that seemed to work – except for the $var problem. It’s so maddening because it only affects the text component – any other component (sound, movie, image) happily accepts $var. And, everything else runs as it should.

Re the paramsCtrl.py file I did do a global search and no luck. I will do another deep dive into the .wine directory and see if there’s anything there.

Commented out these lines, but same $var problem :crazy_face:

Hi @Catherine_Hanson

Well… unfortunately, I’m not sure what is happening there…

I’ve just upgraded to Ubuntu 23.04 and reinstalled PsychoPy (since it was not running anymore after the upgrade) using this tutorial.

As I expected, PsychoPy crashed when I typed a dollar sign $ inside a text component. Nevertheless, commenting out lines 75 to 85, as I suggested above, worked as a charm.

Information that may be useful to you:

  • I’ve installed Psychopy version 2023.1.2
  • My paramsCtrl.py file, is located at:

/home/user_name/Environments/psychopy-py38/lib/python3.8/site-packages/psychopy/app/builder/dialogs/

Best regards

Hi, my paramsCtrl.py file is located here: ~/Environments/psychopy-py38/psychopy-2023.1.2/build/lib/psychopy/app/builder/dialogs

I did comment out lines 75-85, but didn’t help. However, I’ve gone through most releases of PsychoPy and found that the only first one going back that doesn’t have this problem is version 2022.1.2 under either Python 3.8 or 3.9 - However, there is a glitch which is that $var cannot be input on the top line, but needs to be typed elsewhere and then moved to the top manually with the return key. Here’s a link to a screencast of what I mean. You’ll probably need to download the mkv file. So, what this means is that something changed somewhere around the 2022 release and, in fact, this text component bug started being reported in 2022. Note: the 2022.1.2 version was installed in a venv using pip and Python 3.8.

1 Like

Hi,

I’m currently trying to use the workaround mentioned above by bastosfh however so far without success.

I installed psychopy v2023.1.3 via pip into my anaconda base environment on Ubuntu 20.04. My problem is that commenting out the specified lines in paramsCtrl.py does not seem to take any effect. I assume that this is the case because I did not install psychopy as “editable” (i.e. using pip install -e).

Nevertheless, reading through this thread, it was not mentioned by any of the people who were successful with this workaround that they installed psychopy in editable mode. Or am I missing something?

Would be very grateful for any feedback on this.

Best,
Felix

I eventually got it to work using the workaround proposed above. The issue was that I commented out the required lines in the wrong directory. After installing psychopy using pip, the file that needed to be changed was located in /home/<user>/anaconda3/lib/python3.8/site-packages/psychopy/app/builder/dialogs/paramCtrls.py. Commenting out the specified lines in the end worked for me.

Thanks so much for sharing this workaround.

In 2023.2.0 (releasing in the next few days), this should be fixed!

The source of the problem was that the font in the text was set to bold via .SetFont - which is perfectly fine on most wx installs, but in some cases (e.g. Python 3.10 on Ubuntu via pip) this method caused a recursion error. We’ve essentially sidestepped the issue by using .SetStyle instead, which has the same effect without erroring, so hopefully this should no longer be an issue!

1 Like