Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

PyGaze and Tobii EyeX eye tracker

edited July 4 in PyGaze

Hello!
I’m new to OpenSesame and I’m trying to run an experiment including the Tobii EyeX. I’ve never used an eye tracker before, but I know that this one is quite simple and (from what I red in this forum) it can be integrated in OpenSesame.
Unfortunately, I couldn’t find a clear explanation about how to use the PyGaze item, except for this: http://osdoc.cogsci.nl/3.1/manual/eyetracking/pygaze/#pygaze-opensesame-plugins.
Please, can you help me to make it work providing me the correct sequence of the items and the way to include Tobii EyeX?
So far, every time I try to run my experiment this message occurs:

File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 154, in run
    exp.run()
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 439, in run
    self.items.execute(self.var.start)
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
    self.run(name)
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
    self[name].run()
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
    self[name].run()
  File "C:\Program Files (x86)\OpenSesame\share\opensesame_plugins\pygaze_init\pygaze_init.py", line 217, in run
    **kwdict)
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\eyetracker.py", line 91, in __init__
    from pygaze._eyetracker.libtobii import TobiiProTracker
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 9, in <module>
    import tobii_research as tr
ImportError: No module named tobii_research

Thank you!

Comments

  • Hi Martina,

    You need to install the tobii-research package. The easiest way to do that is with the Python package manager:

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Thank you for your answer Sebastiaan!
    Unfortunately I'm still having some iussue. When I find the tobii-research package in the Python package manager and click on "Install", the message "Failted to installed tobii-research" occurs. During this, the debug window shows this:
    Collecting tobii-research
    Using cached https://files.pythonhosted.org/packages/7c/0a/454ceaec763119fb9fbac763ba39ca47eb4dc9bc825ca243e7874722462e/tobii_research-1.5.0-cp27-cp27m-win32.whl
    Installing collected packages: tobii-research

    So I tried to type "pip install tobii-research" in the debug window, but this is the outcome:
    File "", line 1
    pip install tobii-research
    ^
    SyntaxError: invalid syntax

    I also downloaded the file tobii_research-1.5.0-cp27-cp27m-win_amd64.whl from the link that you gave me, but I don't know how to use a file with the .whl extension.

    How can I solve this problem?

    Thank you again!

  • Hi Martina,

    Have you tried running OpenSesame as adminstrator? If you have, could you post the complete error message that you see in the debug window? (It seems that you posted only the beginning.)

    So I tried to type "pip install tobii-research" in the debug window, but this is the outcome:

    If you want to do this from the debug window, you need to use pip as a Python library, like so:

    import pip
    pip.main(['install', 'tobii-research'])
    

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited July 11

    Hi Sebastiaan!

    Thank you for your suggestion, I wasn't running OpenSesame as administrator (I did it and it worked, tobii-research package has been installed!).

    However, now I have a different problem (I think). When I run my script using my Tobii, this message appear in the debug window:

    Starting experiment as ExperimentProcess-1
    Expyriment 0.8.1.opensesame2 (Python 2.7.12) 
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
    experiment.run(): experiment started at Mon Jul 09 17:31:47 2018
    experiment.run(): disabling garbage collection
    experiment.end(): enabling garbage collection
    
    Unexpected error
    
    item-stack: experiment[run].pygaze_init[run]
    exception type: ImportError
    exception message: No module named tobii.eye_tracking_io.basic
    time: Mon Jul 09 17:31:47 2018
    
    Traceback:
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 150, in run
        exp.run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 411, in run
        self.items.execute(self.var.start)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 91, in execute
        self.run(name)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 106, in run
        self[name].run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
        self.experiment.items.run(_item)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 106, in run
        self[name].run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\share\opensesame_plugins\pygaze_init\pygaze_init.py", line 204, in run
        **kwdict)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\eyetracker.py", line 82, in __init__
        from pygaze._eyetracker.libtobii import TobiiTracker
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 50, in <module>
        from tobii.eye_tracking_io.basic import EyetrackerException
    ImportError: No module named tobii.eye_tracking_io.basic
    

    Is there something else that I need to install in order to use my Tobii EyeX? Can you help me with this iussue?

    Thank you!

    Martina

  • Hi Martina,

    It looks like you're using an old version of OpenSesame that includes older version of all the necessary libraries. So the Tobii functionality is probably simply broken.

    Would it be an option to upgrade to the latest version of OpenSesame (currently 3.2.4)?

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited July 17

    Hi Sebastiaan!

    Yes, I'm already using the last vesrion of OpenSesame (3.2.4).

    Anyway, now a different message appears when I try to run your template for eye-tracking experiments; here is it:

    Starting experiment as ExperimentProcess-1
    Expyriment 0.9.1b2-11-gc100ee8 (Python 2.7.13) 
    Scripts/safelaunch-opensesame.py
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
    experiment.run(): experiment started at Thu Jul 12 11:24:11 2018
    experiment.run(): disabling garbage collection
    experiment.end(): enabling garbage collection
    
    Unexpected error
    
    item-stack: experiment[run].pygaze_init[run]
    exception type: UnicodeEncodeError
    exception message: 'ascii' codec can't encode character u'\xe0' in position 37: ordinal not in range(128)
    time: Thu Jul 12 11:24:14 2018
    
    Traceback:
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 154, in run
        exp.run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 449, in run
        self.items.execute(self.var.start)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
        self.run(name)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
        self[name].run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
        self.experiment.items.run(_item)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
        self[name].run()
      File "C:\Program Files (x86)\OpenSesame\share\opensesame_plugins\pygaze_init\pygaze_init.py", line 217, in run
        **kwdict)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\eyetracker.py", line 95, in __init__
        self.__class__.__init__(self, display, **args)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\libtobii.py", line 107, in __init__
        self.datafile = open("{0}_TOBII_output.tsv".format(logfile), 'w')
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 37: ordinal not in range(128)
    

    I'm sorry to bother you again. What can I do in this case?

    Thank you!

    Martina

  • Hi Martina,

    This appears to be a character encoding bug in PyGaze. If you select a logfile location that doesn't have any special (non-ascii) characters in it, does the error go away?

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Interesting issue! Any ideas on how to solve it, Sebastiaan? (You're the encoding nerd ;) )

  • Yes, I filed a bug report here!

    Thanked by 1Edwin

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Just to update the issue on this platform too: The EyeX does not seem to be supported by the new Tobii SDK, which means the current tobii TRACKERTYPE is unlikely to work with the EyeX. (To be honest, I'm a bit confused by the specifics, but it seems like Tobii introduced a mechanism that actively prevents the EyeX from being used with the new SDK to collect data, as this is something they explicitly forbid in their end-user license agreement?)

    There exists an older implementation in the tobii-legacy TRACKERTYPE, which is based on the previous Tobii SDK. (I'd wager that that also isn't non-ascii safe, although I haven't gone back and checked it.) Unfortunately, using this TRACKERTYPE means you'd need all the old Tobii SDK software too, which is proprietary stuff available from Tobii only.

    For the whole discussion, see the issue that @sebastiaan filed on GitHub: https://github.com/esdalmaijer/PyGaze/issues/120

    Sorry we couldn't be of more help!

Sign In or Register to comment.