# Nothing happens after calling runSetupProcedure()

I am using an Eyelink 1000 with Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 12:45:02) [MSC v.1900 32 bit (Intel)] on win32, with a host computer and a display computer.

I had a previous error that was solved, but I suspect that it might be relevant, so I am linking it here: "Unable to share contexts" error when creating window (this is the reason for the first two lines in my code regarding pyglet)

I am trying to run this block of code:

import pyglet

from psychopy import visual, core, data, event, logging, gui, sound
from psychopy.iohub.client import launchHubServer

{'name': 'tracker',
'runtime_settings': {'sampling_rate': 500,
'track_eyes': 'LEFT'}
}
}

io=launchHubServer(**iohub_config)
io_kb = io.devices.keyboard

eyetracker = io.devices.tracker
r = eyetracker.runSetupProcedure()

eyetracker.setConnectionState(False)

io.quit()


The problem here is that nothing appears on the screen when eyetracker.runSetupProcedure() is called, although it seems that the eyetracker starts to connect (it says TCP/IP Link Open) on the host computer. I have verified that eyetracker is getting the correct device. I have tried calling it without assigning it to a variable but that doesn’t work. I have also tried the following code:

window = #some code to create window #
window.winHandle.minimize()
eyetracker.runSetupProcedure()
window.winHandle.activate()
window.winHandle.maximize()


The window appears (with whatever I drew), but the calibration screen doesn’t come up. Pressing any key (C,V,Enter,Esc, etc.) just causes Python to crash (the ‘Not Responding’ error comes up).

The calibration screen appears when I run it via MATLAB, Experiment Builder, and EPrime. Not very sure what is going on here, especially since there are no error messages.

I have the exactly same issue. I think this bug is within psychopy3 only, as your scripts work in psychopy2. So use psychopy2 instead, or try to import and use pylink library directly – the eye tracker modules of psychopy are based on pylink. You can see this to get start with pylink.

(Probably) please ignore my last post; this is embarrassing. I tested the latest PsychoPy source myself using the psychopy\demos\coder\iohub\eyetracking\selectTracker\run.py demo with an eyelink and realized a bug was added by mistake during some ‘code cleanup’. I get this error:

 pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
RPC_DEVICE_RUNTIME_ERROR
Traceback (most recent call last):
File "D:\DEV\WinPython3-64bit\python-3.6.7.amd64\lib\site-packages\psychopy-3.2.4-py3.6.egg\psychopy\iohub\server.py", line 266, in handleExperimentDeviceRequest
result = method()
File "D:\DEV\WinPython3-64bit\python-3.6.7.amd64\lib\site-packages\psychopy-3.2.4-py3.6.egg\psychopy\iohub\devices\eyetracker\hw\sr_research\eyelink\eyetracker.py", line 400, in runSetupProcedure
if starting_state != EyeTrackerConstants.DEFAULT_SETUP_PROCEDURE:
NameError: name 'starting_state' is not defined


The fix is to remove lines 400 and 401 from psychopy\psychopy\iohub\devices\eyetracker\hw\sr_research\eyelink\eyetracker.py
like:

#        if starting_state != EyeTrackerConstants.DEFAULT_SETUP_PROCEDURE:
#           printExceptionDetailsToStdErr()



I have fixed the bug and created a PR. With this fixed the demo runs fine again as tested on Windows 10 64 bit.

1 Like

I also just tried running your original example code posted and, using the fixed source, it now runs fine for me on my Windows 10 64 bit laptop.

Please remember to install the correct pylink package for your Python if not using a prebuilt env. from Jon.

Thanks, and sorry, again

Dear all,
Please allow me to jump in the discussion. I am using Psychopy 3 (last version) on windows 10 64 bits. I had the same problem with Eyelink 1000, that I could finally fix this morning thanks to Sol response (thank you so much!).
My problem now is that I am preparing an experiment for an Eyelink 1000 plus (with a laptop host), and I was not able to use ioHub so far (even after fixing the lines 400 and 401 in eyetracker module). Running the demo gives me the folowing error message :

##### Running: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos\coder\iohub\eyetracking\selectTracker\run.py #####
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos\coder\iohub\eyetracking\selectTracker\run.py", line 288, in <module>
main(configurationDirectory)
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos\coder\iohub\eyetracking\selectTracker\run.py", line 277, in main
runtime=ExperimentRuntime(configurationDirectory, "experiment_config.yaml")
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\iohub\client\expruntime.py", line 152, in __init__
self.hub = self._initalizeConfiguration()
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\iohub\client\expruntime.py", line 417, in _initalizeConfiguration
self.hub = ioHubConnection(None, ioHubConfigAbsPath)
File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\iohub\client\__init__.py", line 296, in __init__
raise RuntimeError('Error starting ioHub server')
RuntimeError: Error starting ioHub server
ioHub Server Process Completed With Code:  1


I also have the same message using a minimal script for starting ioHub server (I initially described the problem here: Error with ioHub demo for Eyelink). Is there anything special that I have to do to use Eyelink 1000 plus ? maybe something to change in the yaml file or some settings on the Eyelink laptop host ?

Thank you so musch for any help !

Hi,

I’m getting the exact same error using an Eyelink 1000 Plus with Windows 7, psychopy v3.2.4

I’d be surprised if this issue were specific to Eyelink 1000 Plus and didn’t affect Eyelink 1000. Do you have both systems for testing? I’ve tried editing the yaml file (the one I have has EYELINK 1000 TOWER as model_name but the error is still exactly the same.
Any ideas of other things to try?
Many thanks!

Something is going wrong in the iohub tracker selection code when using the eyelink 1000 plus, some of which is eyelink model dependent based on the return value of pylink’s .getTrackerVersionString().

I only have an eyelink 1000 to test with. I will likely need to add some extra debugging code and have you run it it figure out what is going on. I’ll do that Monday. Can I email you directly to work on testing the solution?

Thanks.

It might also be useful for debugging purposes to try changing some of the config settings and see if any of them get around the error on the eyelink 1000+. The eyelink config file for that demo is in \demos\coder\iohub\eyetracking\selectTracker\eyetracker_configs\eyelink_config.yaml,

You could try changing these settings one at a time and see if any go OK:

model_name: EYELINK 1000 DESKTOP

enable_interface_without_connection: True

simulation_mode: True

runtime_settings:
sampling_rate: 500
track_eyes: BINOCULAR


Thanks again.

Could you also please send me an eye.log file from the EyeLink 1000 plus host PC for when you ran the iohub test script? That should have every command that iohub is sending to eyelink when the tracker is being configured and which, if any, is failing on the el1000+.

Please first restart the eye tracker hardware and then rerun the script so that the eye.log file that is created only contains data from running the test.

Thanks again.

Dear Sol and Mison,
Thanks a lot for responding! Of course, feel free to email me directly (laure.spieser@univ-amu.fr), I’ll be happy to run any tests of course. I am going to the lab right now and give you more news very soon.
To respond to Mison, yes, I have tested on both 1000 and 1000 plus and I have the problem only with 1000 plus (demo runs without problem on 1000). I used the same display PC in both cases, bu it is possible that the two eyelinks have different settings that I did not notice (I am new with eyelink…).

Hi again,
I tried with the changes you suggested in the config file. Now, the experiment is running but I cannot interact with the eyetracker and I had the following error message:

##### Running: C:\Program Files\PsychoPy3\lib\site-packages\psychopy\demos\coder\iohub\eyetracking\selectTracker\run.py #####
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
starting calib
calib done
ioHub Server Process Completed With Code:  0


I have the eye.log file, but there is more than 1000 lines so I did not to copy/paste here, how would you like to proceed ? should I email you ?
Thank you again

Hi,
I’ve been changing the settings following Sol’s recommendations and it now seems to be working for me. For my Eyelink 1000 Plus, the demo is working with the following settings:
enable_interface_without_connection: True
simulation_mode: False

sampling_rate: 500
track_eyes: BINOCULAR

The difference in my setup seems to be related to using BINOCULAR, as it’s not working when using LEFT_EYE (when tracking the left eye in monocular mode).

@sol , is it possible that some of the information sent by the pylink wrapper is missing? For instance, with a good calibration from one eye and a fair one with the other, the calibration screen outcome appears as ‘Calibration Failed or Incomplete’, when ideally one would like to keep using the ‘good’ eye.

In any case, thanks a lot for your help!

This tells iohub to use pylink in ‘dummy’ mode, so no connection is make to the tracker. If turning this on / off makes the issue occur or not, then iohub is likely sending some setup command(s) to the eyelink1000+ that it does not like. An eye.log should help confirm this.

@mison, does your experiment still run if enable_interface_without_connection is set to False, or does the issue seem to be related to the eye selection parameter like you were thinking?

Thanks again.

Hi Sol,

Sorry, I should have written enable_interface_without_connection: False. When set to False, the eye tracker worked fine (easy to see with the online feedback from the demo). If set to True, as you said, the Demo ran without giving errors but no eye tracker data was generated.

Many thanks,

oh, it works with binocular ! that’s already a super good news ! Sol, I am going to send you the eye.log that I obtained with binocular (working) and right_eye (resulting in the Error “ioHub server completed with Code:1”).
Thanks a lot

@mison, so a current workaround for the el1000+ iohub interface issue is to set the eyelink device config to use binocular tracking

track_eyes: BINOCULAR


Is that correct? Sorry if I’m being a little thick headed.

I’m sure we can get monocular tracking working as well once I know what command difference there is.

Thanks for all the testing so far.

I have only tested the demo, but yes, it worked on the el1000+ with :

track_eyes: BINOCULAR


This is exactly right. The track_eyes: BINOCULAR seems to do the trick. Note that one could also get the monocular tracking version by starting in binocular mode, but then selecting on the host computer: Eye(s) to Track: Left (or Right), followed by ‘Lock Tracked Eye’.
I’m happy to send you the eye.log file, in case it helps.

Thanks

Looks like there is a small difference in how the el1000 vs el1000+ command to change eyes is done that might be the source of the monocular el1000+ iohub issue. Working with @lspieser this week to try and fix; will post when we have a confirmed fix.

Thanks again.

With the help @lspieser we figured out what command was causing an error for eyelink 1000+ in monocular modes and the fix for it has been added to a PR. The specific fix for this boils down to commenting out the following line from the iohub eyelink eyetracker.py file:

self._eyelink.sendCommand('current_camera = %s' % (track_eyes))


Sending this command to el1000+ returns an error, which iohub is trying to report by using it’s print2err function. However, at least on Windows, if you run the script in the Coder app, the iohub server does not start if iohub calls print2err at all during initialization. The print2err text is not printed and the iohub server fails with the error shown in the OP, which is printed by iohub client code in the PsychoPy process. This seems to be some type of print2err + Coder interaction that has been introduced at some point in time as it runs fine when Coder is not used to launch the script.

This is a general issue when using Coder with iohub. The current work around is to run your experiment from the cmd prompt in Windows instead of from Coder. Things run fine if the script is started outside of Coder. To do this start the cmd.exe program (or similar) and then run:

cd C:\Program Files\PsychoPy3
python.exe path\to\your\script.py


where C:\Program Files\PsychoPy3 is the installation path of PsychoPy3 and path\to\your\script.py is the full path to the experiment script you want to run.

Coder + iohub calling print2err worked fine before, how long ago I’m not sure. Will try and investigate next week. Created an issue for this on github.

Thanks.