psychopy.org | Reference | Downloads | Github

Visual C++ Runtime error and Python/pythonw.exe crash

Before yesterday, PsychoPy v3.1.5 was working and running experiments fine and as expected (on a Windows 10 PC), but since yesterday, when launching PsychoPy and going to the Builder or accessing Preferences, the attached error occurs. Nothing had been updated or installed between it last being known to work and this first occurring. However, it is a university IT-managed machine, so who knows?

PsychoPy%20crash%20-%20Visual%20C%20%20%20Runtime%20Library%20issue

After OK is clicked, Python crashes:
image

We have tried updating PsychoPy to 3.2.4, both x86 and x64 versions, including uninstalling/rebooting in between, as well as manually updating the Visual C++ redistributable and Python (3.6.6 and 3.8).

If anyone has any ideas how to fix this, please let me know.

Running the troubleshooting command results in this:

C:\Windows\system32>"C:\Program Files\PsychoPy3\python.exe" -m psychopy.app.psychopyApp
A s s e r t i o n   f a i l e d !

 P r o g r a m :   C : \ P r o g r a m   F i l e s \ P s y c h o P y 3 \ p y t h o n . e x e
 F i l e :   s r c / h o s t a p i / w d m k s / p a _ w i n _ w d m k s . c ,   L i n e   1 0 6 1

 E x p r e s s i o n :   F A L S E

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Any ideas?

a google search for the critical line:

reveals this:
https://github.com/psychopy/psychopy/issues/2476
which suggests a problem with audio libraries (so my guess is that your IT people have done some sort of update to an audio lib that added an incompatible version).

Try changing the audio lib that PsychoPy is using by going to your userprefs file in %appdata%\psychopy3 and set it to something like this

[hardware]
    audioLib = pyo, sounddevice, pygame

Or you could even put pygame first if you’re sure that sound timing doen’t matter to anyone using this machine!

Thank you so much for looking into this and providing this info, Jon. Much appreciated.

I had already taken the nuclear option and re-imaged the machine (as this is what IT did to solve the issue previously), but have noted this fix/workaround for if/when it happens again.

Sadly, the issue has returned (perhaps not surprisingly after a Windows update), but the suggested sound device userPrefs fix doesn’t work. :frowning:

However, this time it’s just Python that crashes and no mention of C++ runtime errors, so possibly a different issue? Deary me.

Thanks in advance.

Sorry, could you clarify what’s happening now then? There are no error messages at all? And you’ve trying to run from the terminal but nothing happens? That’s very puzzling indeed.

Apologies for not being clearer, Jon.

There’s no error other than the “Python has stopped working” dialog when opening via GUI.

When running the troubleshooting command line, I get the same as before (without the line starting "This application has requested…), but the userPrefs/audioLib workaround still doesn’t work here.

Please let me know if you have any other ideas and/or if there’s any other info I can provide to help.

I still feel like this is something to do with sound libs btu very hard to debug when I can’t go and start testing myself.

Let’s try and work out what parts of PsychoPy can/can’t load. Could you start up Python in the terminal:

C:\Program Files\PsychoPy3\python.exe

and then try importing psychopy as a second step (and possibly then parts of psychopy if the first one works):

import psychopy
from psychopy import sound
from psychopy.app import psychopyApp

I know, I’m sorry. But very grateful of your assistance.

Yep, you’re right. It crashes right after from psychopy import sound. And the hardware/userPrefs line for audio libs is audioLib = pyo, sounddevice, pygame and the crash occurs whether it’s that line or any one of those alone (which may or may not be expected).