CPU: Apple silicon M4
OS (e.g. Win10): Sequoia 15.3.2
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2024.2.4
Python: 3.10.11
Standard Standalone Installation? (y/n) If not then what?:y
**Do you want it to also run online? (y/n)**y
What are you trying to achieve?:
Hello,
I am trying to make an online gambling task on PsychoPy builder and I am having an issue with the keyboard input once the participant chooses one of the two gambles on screen. The specific routine where this happens is the first routine (“choice routine”) of my trial loop that prompts for an input (3rd routine out of the 8 that form the trial loop, two other routines after this one prompt for an input). The two gambles are represented as pies next to each other and the participant has to press left arrow or right arrow to choose. The next routine just shows the gamble that was chosen. The “choice” routine is force ended with the keypress through a keyboard component (data stored is last key and everything is checked except store correct). To show only the chosen gamble on the next routine I want to extract the keyboard keypress with getKeys (from either event or keyboard) at the end of the “choice” routine. But .getKeys() sometime returns an empty list or a list without the latest keypress, crashing the code.
I want to emphasize the randomness of this issue, it seems to be happening whenever it wants, sometime I can do 8/10 trials before any issue, sometime not even 1.
For the first reason I will be mentioning below, I believe this is a PsychoPy issue rather than something wrong with my experiment.
If someone very familiar with PsychoPy’s inner workings can help, it would be much appreciated!
What did you try to make it work?:
I tried many things to fix this issue:
I first tried to run a previous experiment (coded by someone else, on a different computer) that I know, worked perfectly, and I found that I was having the same issue when the code tried to retrieve the inputs. Which leads me to believe that this is a PsychoPy issue, maybe because of the m4 chip?
other tried fixes (not as relevant):
- Using keyboard.getKeys() instead of event.getKeys().
- Using PsychToolBox instead of ioHub
- Putting the code at the beginning of the next routine instead of having it at the end of the “choice” routine. Thinking that maybe the routine ended “so quickly” after the force end routine that the keypress didn’t have the time to save.
- In the same spirit as the previous unsuccessful fix, I placed a blank 2 frames (0.04s) routine between the “choice” and the next routine. Thinking this would give even more time for the code to “save” the keypress.
- I tried installing the same PsychoPy version (the newest) to an older Intel Mac and still ran in this issue… Also tried the “compatibility Psychopy version” and still didn’t work…
- I searched what I could on internet but I couldn’t find any answer
All the fixes were unsuccessful…
This is the error message I got from testing the previous experiment that worked perfectly on other computers: