psychopy.org | Reference | Downloads | Github

Iohub in Python 3 error: (109, 'PeekNamedPipe', 'The pipe has been ended.')

The title covers the high points; things have been mostly stable in Python 3 so far (huge thanks for getting a compatible build up), but I’ve hit a wall with iohub. I’m trying to follow along with the code snippet here: http://www.psychopy.org/api/iohub/starting.html (hoping to eventually work up to the eyetracking example https://github.com/psychopy/psychopy/blob/master/psychopy/demos/coder/iohub/eyetracking/simple.py).

First the easy bugs to get things up to where I am:

  1. line 59 in iohub’s main init is a call to fix_encoding.fix_encoding() that breaks and its stated purpose is to work around a bug that no longer exists, so I just removed it.

  2. iohub.client’s init has several file() calls that need to be turned into open() calls.

With that done, trying to execute io = launchHubServer() in an Anaconda IPython shell produces the following:

  File "<ipython-input-2-ddadd0fc78da>", line 1, in <module>
    io = iohub.client.launchHubServer()

  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1509, in launchHubServer
    return ioHubConnection(ioConfig)

  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 291, in __init__
    self.iohub_status = self._startServer(ioHubConfig, ioHubConfigAbsPath)

  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 949, in _startServer
    isDataAvail=self._serverStdOutHasData()

  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1057, in _serverStdOutHasData
    raise e

  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1050, in _serverStdOutHasData
    (read, nAvail, nMessage) = PeekNamedPipe(x, 0)

error: (109, 'PeekNamedPipe', 'The pipe has been ended.')

Googling around the only mention of this error I saw with any response mentioned the possibility of permission problems when someone was trying to run the ioHubDelayTest demo, so for comparison I gave its run.py a shot from command line in a definitely-writable location and got essentially identical traceback (plus another file() call I guess I should fix):

(C:\ProgramData\Anaconda3) F:\python\psychopy_demos\coder\iohub\ioHubDelayTest>python run.py
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\launchHubProcess.py", line 134, in <module>
    run(rootScriptPathDir=rootScriptPathDir, configFilePath=configFileName)
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\launchHubProcess.py", line 31, in run
    ioHubConfig=load(file(configFilePath,'r'), Loader=Loader)
NameError: name 'file' is not defined
Traceback (most recent call last):
  File "run.py", line 270, in <module>
    runtime=ExperimentRuntime(module_directory(ExperimentRuntime.run), "experiment_config.yaml")
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1608, in __init__
    self.hub = self._initalizeConfiguration()
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1860, in _initalizeConfiguration
    self.hub = ioHubConnection(None, ioHubConfigAbsPath)
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 291, in __init__
    self.iohub_status = self._startServer(ioHubConfig, ioHubConfigAbsPath)
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 949, in _startServer
    isDataAvail=self._serverStdOutHasData()
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1057, in _serverStdOutHasData
    raise e
  File "C:\ProgramData\Anaconda3\lib\site-packages\psychopy\iohub\client\__init__.py", line 1050, in _serverStdOutHasData
    (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
pywintypes.error: (109, 'PeekNamedPipe', 'The pipe has been ended.')

This one is much less obvious to me, so if anyone can point me in the right direction I would very much appreciate it.

edit: Realized I forgot to include OS; Windows 10.