| Reference | Downloads | Github

Suddenly, my experiments went on strike (the ntdll blues)

OS (e.g. Win10): Win7/Win10
PsychoPy version (e.g. 1.84.x): 1.84.2

I use PsychoPy for all of my experimental needs, and until this month I was perfectly happy with that. However, suddenly and simultaneously, all of my PsychoPy experiments have started (sporadically) crashing. The experiments do disparate things (some involve movie files, some involve sound files; all involve keyboard responses), and are housed on disparate computers (one a very old Win7 computer with poor memory that hasn’t been updated since last summer, one a very new Win10 computer with excellent memory that is constantly up to date). Despite those differences, the sequence of events that leads up to the crash is roughly the same:

  1. I input participant information and start the experiment.
  2. The experiment starts up fine.
  3. Within a couple of minutes, after the participant gives a keyboard response to advance to the next Routine, the experiment hangs, and a message pops up saying that python.exe has crashed. No error messages are generated in PsychoPy; Windows points the finger at ntdll.dll, in a message that looks something like this:

Faulting application name: python.exe, version:, time stamp: 0x56634a05
Faulting module name: ntdll.dll, version: 6.1.7601.23572, time stamp: 0x57fd02d3
Exception code: 0xc0000005
Fault offset: 0x0002e43e
Faulting process id: 0x1244
Faulting application start time: 0x01d298105bf977a9
Faulting application path: C:\Program Files (x86)\PsychoPy2\python.exe
Faulting module path: C:\Windows\SysWOW64\ntdll.dll

ntdll.dll is always the problem across computers. The experiments don’t always crash; one experiment has crashed only once (out of the 5 or so times I’ve run it) but a different version of the same experiment where the only difference is in the stimuli crashes almost all of the time. When they do, though, they are relatively consistent on where they crash within the experiment; for example, in the fourth Routine that displays instructions for one experiment, or during the first or second video stimulus for a different experiment. However, it’s nothing about the individual instruction Routine or any individual video; the program still crashes after deleting all of the instruction Routines (just sometime during the trials), and the order of presentation in the other experiment is random (so it’s not the case that any one video sinks it). If the experiment doesn’t crash within the first couple of minutes, it always completes and saves the data without any issue.

I’m at wit’s end, to be honest. I’ve uninstalled and reinstalled PsychoPy plenty of times, restarted the computers in between crashes, gone through and basically eliminated each Routine one by one, and nothing seems to help. Furthermore, this is new and without any obvious cause. The best example is for the video experiment, where I just finished collecting data in a very similar experiment in the middle of February; I never saw similar errors for the previous one, and the only difference between the two experiments is in a handful of the stimuli (which were encoded identically). PsychoPy was already at 1.84.2 at that point. The experiment that crashes the most was working without issues in December, and neither the OS nor PsychoPy were changed between then and when I started trying to run it again last week.

Oddly, I’ve never had a similar experience on my (Win10) laptop, although the only time I run experiments on my laptop is when I’m programming or when the experiment has crashed on the experimental computers, so that might just be a sample size issue.

Any thoughts? I’m happy to try anything.

Update: downgrading to 1.84.1 did not solve the issue. Upgrading to 1.85.0 produced an error (which I’ve given below) that seems to be unrelated to the ntdll problems. And unplugging one of the computers from the Internet and restarting it also did not help (one of my advisors thought it might be a network issue).

Here’s the error I got in 1.85.0:

Running: C:\Users\linguser\Desktop\Sepulchre\Sepulchre Training
pyo version 0.8.0 (uses single precision)
Traceback (most recent call last):
File “C:\Users\linguser\Desktop\Sepulchre\Sepulchre Training”, line 139, in
sound_1 = sound.Sound(‘A’, secs=-1)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\sound\”, line 276, in init
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\sound\”, line 125, in init
audioDriver, outputID = _bestDriver(devNames, devIDs)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\sound\”, line 28, in _bestDriver
osEncoding = sys.getfilesystemencoding()
NameError: global name ‘sys’ is not defined

Sorry to triple post, but I found a temporary (if unsatisfactory) solution: downgrading to 1.83.4. I apparently didn’t downgrade back far enough. I’ve only checked this on one computer, but will confirm on others soon enough. However, the upgrade to 1.84.2 coincides within a day of the first appearance of error messages on one of the computers. I’m not entirely comfortable with laying the blame solely on the version change—I don’t think I installed a 1.84 version on one of the other computers anytime recently, for example—but it does seem to be one of the biggest causes. This problem is not just affecting me, though; it’s affecting other users of PsychoPy using the same computers. So I’m not sure that it’s anything in our individual experiments per se that is causing the problem.

Besides ntdll, after poring over the error logs on the computer, I noticed another error that has been occurring that looks like this:

Faulting application name: python.exe, version:, time stamp: 0x56634a05
Faulting module name: umath.pyd, version:, time stamp: 0x572b9e76
Exception code: 0xc0000005
Fault offset: 0x0000ad30
Faulting process id: 0xda4
Faulting application start time: 0x01d29445be79af83
Faulting application path: C:\Program Files (x86)\PsychoPy2\python.exe
Faulting module path: C:\Program Files (x86)\PsychoPy2\lib\site-packages\numpy\core\umath.pyd

A different error comes up at the end of many successful experimental runs that looks like this:

Faulting application name: python.exe, version:, time stamp: 0x56634a05
Faulting module name: portmidi.dll, version:, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x00002627
Faulting process id: 0xd48
Faulting application start time: 0x01d2942beeb2f390
Faulting application path: C:\Program Files (x86)\PsychoPy2\python.exe
Faulting module path: C:\Program Files (x86)\PsychoPy2\lib\site-packages\portmidi.dll
Report Id: 4fd18ac5-0021-11e7-97f7-bc305bc66846

Hopefully this can be fixed in future patches? I’m very excited about the online experiment capabilities of 1.85; I’d love to update eventually.

I’m afraid I’ve never seen this error and cant reproduce it on my own Win7 installation. I’m guessing this is a change in one of the dependencies rather than PsychoPy itself but while I can’t reproduce the problem myself I’m unable to debug where it comes from.
The fact that it fails differently loading a range of different libraries is very suspicious and I wonder if it’s something special about the system setups or permissions, but I really don’t know.

Hi Jon - sorry for the delay. I have some more error messages, in case they’re helpful. After the downgrade to 1.83.4, all of my experiments that don’t involve Movie stims are working fine, but all of my experiments with Movie stims are still breaking after a couple of videos are played. In 1.83.4, I get this error (with the movie file breaking never being consistent):

Traceback (most recent call last):
File “…”, line 732, in
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\”, line 121, in init
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.7.egg\psychopy\visual\”, line 168, in loadMovie
self._audioStream = sound.Sound(,
File “”, line 2, in to_soundarray
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\”, line 54, in requires_duration
return f(clip, *a, **k)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\audio\”, line 114, in to_soundarray
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\numpy\core\”, line 230, in vstack
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\audio\”, line 81, in generator
File “”, line 2, in to_soundarray
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\”, line 54, in requires_duration
return f(clip, *a, **k)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\audio\”, line 127, in to_soundarray
snd_array = self.get_frame(tt)
File “”, line 2, in get_frame
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\”, line 89, in wrapper
return f(*new_a, **new_kw)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\”, line 95, in get_frame
return self.make_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\audio\io\”, line 71, in
self.make_frame = lambda t: reader.get_frame(t)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\moviepy-\moviepy\audio\io\”, line 196, in get_frame
"but len(buffer)=%d\n"%(len(self.buffer))+ str(error))
IOError: Error in file Stimuli/Videos/, At time t=11.34-12.47 seconds, indices wanted: 100000-149999, but len(buffer)=110980
index 110980 is out of bounds for axis 0 with size 110980
Exception TypeError: “‘NoneType’ object is not callable” in <bound method Server.del of <pyolib.server.Server object at 0x04F1F330>> ignored
AsioDrv::: CAsioDrv()…
AsioDrv::: InitWdmDrv()…

Oddly, this error now pops up for my final dissertation experiment, which was working fine through mid-February.

I think as a next step I can check to see how broadly distributed these problems are on campus. Although the computers I have access to are pretty heterogeneous, I could get more data on whether they’re afflicting others, too, so that it’s some sort of strange campus-wide thing.

Okay, I think I may have found a solution. Upgrading to 1.85.01 seems to have resolved the “sys” issue, while this fix to moviepy seems to make the videos play fine (and without freezing). So, I think the issue is resolved, although we’ll see if anything else crops up!