psychopy.org | Reference | Downloads | Github

RuntimeError: Error starting ioHub server: ioHub startup failed

I’m trying to program an eye-tracking experiment, but failing at the first hurdle.

The script at the moment is currently simply:

from psychopy.iohub.client import launchHubServer
io = launchHubServer()

This fails after some 30 seconds, with the following traceback:

ioHub Server Process Completed With Code:  1
Traceback (most recent call last):
  File "C:\Users\useradmin\Desktop\Protocols\Anti-saccade\Psychopy\Anti-Saccade-task_lastrun.py", line 94, in <module>
    io = launchHubServer()
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\psychopy\iohub\lazy_import.py", line 278, in __call__
    return obj(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\psychopy\iohub\client\connect.py", line 262, in launchHubServer
    return ioHubConnection(iohub_config)
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\psychopy\iohub\client\__init__.py", line 296, in __init__
    raise RuntimeError('Error starting ioHub server: {}'.format(self.iohub_status))
RuntimeError: Error starting ioHub server: ioHub startup failed.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\pyglet\media\codecs\wmf.py", line 834, in __init__
    ole32.CoInitializeEx(None, COINIT_MULTITHREADED)
  File "_ctypes/callproc.c", line 940, in GetResult
OSError: [WinError -2147417850] Cannot change thread mode after it is set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\pyglet\media\__init__.py", line 143, in <module>
    add_default_media_codecs()
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\pyglet\media\codecs\__init__.py", line 175, in add_default_media_codecs
    add_decoders(wmf)
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\pyglet\media\codecs\__init__.py", line 128, in add_decoders
    for decoder in module.get_decoders():
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\pyglet\media\codecs\wmf.py", line 890, in get_decoders
    return [WMFDecoder()]
  File "C:\ProgramData\Anaconda3\envs\psychopy_opensesame_p36\lib\site-packages\pyglet\media\codecs\wmf.py", line 836, in __init__
    warnings.warn('WMF failed to initialize threading:', err.strerror)
TypeError: category must be a Warning subclass, not 'str'
##### Experiment ended. #####

OS is Windows 10 x64, using PsychoPy v2020.1.2 under Python 3.6. It looks like some kind of threading problem? CPU is an Intel Core i7-9700.

I should note that I have tried on a different machine, and there is no failure at that point, but this needs to work on the machine attached to the eye tracker!

did you ever find a fix for this? I’m running in to the same error

Unfortunately not, I ended up going back to OpenSesame.

Thanks - this is really frustrating. Psychopy was working and now I cannot even launch anything!

What version of pyglet are you running? I recently saw a similar error when I was using pyglet 1.5 but got rid of it by going back to pyglet 1.3.1. Thanks.