| Reference | Downloads | Github

Task Seemingly Randomly Freezes

Hi everyone, could someone please help? I’ve searched the forums but have come up short.

OS (e.g. Win10): Windows 7

PsychoPy version (e.g. 1.84.x): 1.90.3

Standard Standalone? (y/n) If not then what?: yes, PsychoPy 2, PY3, 1.90.3

What are you trying to achieve?:

This is my first PsychoPy task. It is a version of the Balloon Analogue Risk Task. It uses session numbers (1-4) to pull specific balloon configurations from excel files for use in the task. It also sends some EEG triggers via PPT 0x378. Please find the related files here:!AkQ6eJJ0SIw5wERrZxXJAsPASAo- (Edit: I have disabled this link subsequent to the work-around on this issue)

Everything works perfectly BUT…

What happens?

The task works as expected BUT then (seemingly) randomly hangs on either the trial screen or the feedback screen. It seems to hang after about 4 minutes of play. In my fiddling it hangs anywhere between balloon 5 and 12… I am having a hard time discovering what reliably makes it freeze. It appears to be related to either the total number of trials/responses, or the total amount of time the task has been running. When it freezes, I must force-quit the task window/full-screen task. Unfortunately this also results in a total loss of data (creates a .log file of 0kb, no .psydat). This force-quit allows me to recover the builder and the output console, however there are no error messages there.

Interestingly, if I use fewer balloons in my trial list, eg: only the first 4 from the session 1 list, the task works exactly as expected, and exits cleanly.

My only hunch is that something is going out of bounds in the longer version of the task, but I have been through my code and have no idea what this may be.

Help! Thank you,


PS: I appreciate the irony that psychopy comes with a BART task example… :slight_smile:

@pk403, I have run through your experiment after removing the parallel ports as I have not set them up. The task froze after several trials. I believe the crash is resulting from too many print statements in your code. Remove all print statements and the task should not crash. There was another bug however, in that your reward variable is undefined on one of your trials, because there are missing values in your conditions file.

1 Like

Hi David, thanks a lot for looking into this!

As you suggested, when I commented out the print statements, the task ran to completion (with the exception noted below). Is it normal behaviour for PsychoPy to crash after a given number of prints to the output console? If yes, what is the limit for this? If no, maybe this should be flagged as a bug?

As regards the conditions file, thanks for spotting this. This extra cell was a check that should have been removed from the conditions file.

Everything is now working properly.

All the best,


I think the printing problem relates to a problem for Builder only, where the buffer used to store the output of the print statements gets overloaded. This does not happen in Coder as far as I know, as the outputs are sent directly to the Output tab real time - see @Michael 's response

Hi David, I can’t seem to find the relevant info in the post you linked to. Michael appears to only discuss issues with the escape key.

Your hunch seems to be correct – if I take the version of the task which crashes in builder, compile the script, and then run it from the coder, the task does not hang.

Is there a process by which I should raise this issue as a bug or is the builder console handled differently in the PsyPy3 beta?