I have been trying to solve the following problem for the last couple of months, but as of yet have not succeeded. I have been successfully running several experiments using an external voicekey (Reacsys vkms-1) and the parallel port with varying PsychoPy versions. Since the voicekey only registers the latency of the response, and the content and the accuracy has to be coded from experimenters (which is far from an easy task), we want to double-check the accuracy of the coding. Thus, in addition to the parallel port voicekey, we wanted to record the trials. We were thus really happy with the development of the voicekey()-function. However, in a large number of sessions, the experiment randomly crashes. Most of the times, we only get the windows message “pythonw.exe has stopped working”. Rarely, at least when we end the experiment prematurely, we get the following error message:
portaudio error in Pa_AbortStream: Wait timed out
portaudio error in Pa_AbortStream: PortAudio not initialized
portaudio error in Pa_CloseStream: PortAudio not initialized
portaudio error in Pa_Terminate: PortAudio not initialized
Error closing audio backend.
Exception TypeError: "'NoneType' object is not callable" in <bound method Server.del of pyolib.server.Server object at 0x17FD5F30 ignored
Importantly, in the majority of sessions, the experiment works well and the PsychoPy recordings and the results from the external voicekey converge rather nicely. We are now using PsychoPy 1.84.2 on a Windows 7 SP1 pc, but the problem also occurs with older PsychoPy and Windows versions.
Oh, and I am under the impression that the experiment is especially likely to crash when there are noises before the initialization of vk.start(). I have played around with starting voicekey.pyo.init() later, but that didn’t do the trick either.
From other threads, I get the impression that this might be caused by pyo – but in this case, I can’t change that to pygame, correct?
I would very much appreciate any help! I have attached the relevant pieces of code below (hopefully- I have deliberately only deleted some parts of the runTrial() to enable a better understanding- if this is still too much, let me know and I will delete more).
# -*- coding: utf-8 -*-
from psychopy import visual
from psychopy import core, event, misc, logging, gui, data, parallel, monitors, voicekey
from psychopy import sound, microphone
from operator import itemgetter
import fragebogen, vragenlijst
import os, itertools
port = parallel.PParallelInpOut32(address=0xD010)
response = event.waitKeys(maxWait='inf',keyList=["num_1","num_2","num_3","num_4","num_5","lctrl"], timeStamped=False)
# response = event.waitKeys(maxWait='inf', timeStamped=False)
for frameN in range(all_time+1):
while (trialClock.getTime()<3.0) and (trial["rt"]==-1):
if mode == 1:
elif mode== 0:
trial["resp"] = list(response)[-1]
print vk.event_detected, vk.event_onset, trialClock.getTime()
if vk.event_onset < 0.1:
while trialClock.getTime() - vk.event_onset < minT: