Howdy, Stranger!

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

Supported by

Gazepoint Control Version 4.2.0 used with PyGaze and Opensesame - Calibration Error

edited May 31 in PyGaze

Hi there,

We have been using a GazePoint eyetracker with version 4.1 of the Controller, Opensesame 3.1.9, and the latest release of the PyGaze package on Windows 7 and Windows 10 machine without incurring into any major trouble. I have been helped by @moreno and @alisdt to set it up.

However, we wanted to update the Gazepoint Control to their latest release, which is 4.2.0. The reason is that it implements a new "P" mode for tracking difficult eyes, and we are often dealing with elderly and clinical populations which are actually harder to track.

But, when we try to run the Gazepoint Version 4.2.0, we got the following error during the calibration phase:

Starting experiment as ExperimentProcess-3
openexp._canvas.legacy.init_display(): enabling hardware surface
openexp._canvas.legacy.init_display(): enabling double buffering
openexp._canvas.legacy.init_display(): video mode ok
openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
openexp.sampler._legacy.init_sound(): mixer already initialized, closing
experiment.run(): experiment started at Thu May 31 15:06:43 2018
experiment.run(): disabling garbage collection
Exception in thread PyGaze_OpenGazeConnection_incoming:
Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenSesame\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "C:\Program Files (x86)\OpenSesame\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\opengaze.py", line 428, in _process_incoming
    command, msgdict = self._parse_msg(msg)
  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\opengaze.py", line 350, in _parse_msg
    e = lxml.etree.fromstring(xml)
  File "src\lxml\etree.pyx", line 3213, in lxml.etree.fromstring
  File "src\lxml\parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
  File "src\lxml\parser.pxi", line 1764, in lxml.etree._parseDoc
  File "src\lxml\parser.pxi", line 1126, in lxml.etree._BaseParser._parseDoc
  File "src\lxml\parser.pxi", line 600, in lxml.etree._ParserContext._handleParseResultDoc
  File "src\lxml\parser.pxi", line 710, in lxml.etree._handleParseResult
  File "src\lxml\parser.pxi", line 639, in lxml.etree._raiseParseError
XMLSyntaxError: attributes construct error, line 1, column 30 (line 1)

@moreno and I suspect that in this latest 4.2.0 of the Gazepoint Control, something in the API must have been changed and consequently PyGaze cannot parse the XML.
As we really are not that familiar with the implementation of PyGaze, we would have to ask PyGaze experts here, as well as you @Edwin, whether you have encountered a similar problem before; and especially whether you would be so kind to help us resolve this issue.

Thank you very much for your precious time.

Comments

  • Heya!

    Thanks for the elaborate description and for posting the full traceback, those are very useful! I hope you don't mind, but I changed your post ever so slightly by putting the traceback info between ~~~ flags to make it render as code. This makes it slightly more readable :)

    As for the actual issue: It sounds like your analysis is correct. I haven't tried the new API yet, so haven't run into the issue myself, but your error message is from the lxml library (which is native Python; not something that we concocted!), and seems to indicate that the xml message that it tried to parse was malformed. For example, this can happen when a space is missing from the message, or a closing quotation is forgotten.

    Whether this malformed message came directly from the GP tracker is something that is hard to say. It could well be, but it could also be that the message was partly lost along the way someplace. One thing you could try is to ask GazePoint about this specific point, as they will know whether they might have changed anything that could have introduced malformed xml.

    In the meantime, if I have some time (which is not likely to be very soon - especially not this week or the next), I'll have a look at whether I can reproduce the error, and whether I can find a workaround.

    Good luck!
    Edwin

    Thanked by 1moreno
  • edited June 5

    Hi there,

    we have been in touch with Gazepoint developers and apparently, a potential source of conflict was that in Gazepoint 4.2 there was a bug

    <ACK ID="USER_DATA" VALUE="0"DUR="0" /> 
    

    Basically, a missing space ...

    So, they gave us today an updated version (4.3) to be released very soon wherein such bug was fixed.
    I do not know whether that was the true cause of the problem, but we seem now to be able to track just fine using PyGaze and Opensesame, and their latest 4.3 version ... so, at least for now ... problem solved!

    Moreno

    Thanked by 1Edwin
  • Hi Moreno,

    Amazing, thanks for the update! That missing space is very likely to have been the cause of the lxml hickup, as it would fail to understand that VALUE="0"DUR="0" actually means VALUE="0" AND DUR="0".

    Cheers,
    Edwin

    PS: I totes called it :sunglasses:

    [...] this can happen when a space is missing from the message [...]

    Thanked by 1TomArmstrong
  • Hi all,

    I am posting in this thread rather than creating a new one because I suspect it is a similar issue. In both Gazepoint 4.3 and the new 5.1 release, I encounter this error at the pygaze_init object (with opengaze selected as the tracker). I'm using Windows 10 with OpenSesame 3.2.5.

    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 157, in run
        exp.run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 456, 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 118, in __init__
        from pygaze._eyetracker.libopengaze import OpenGazeTracker
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\libopengaze.py", line 41, in <module>
        from opengaze import OpenGazeTracker as OpenGaze
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\opengaze.py", line 13, in <module>
        import lxml.etree
    ImportError: No module named lxml.etree
    

    If you suspect it's another bug in the Gazepoint API, I will follow up with them.

    Thanks all! And special thanks to @Edwin for adding Gazepoint to PyGaze and keeping the dream of cheap eye tracking alive :)

    Tom

  • edited November 4

    Hi Tom,

    Good to see you here! Thanks for flagging this up. It's due to a bug (malformed xml) in the GazePoint API. There are two workarounds:

    1) You can ask GazePoint for a pre-release of their API, which had the bug fixed.

    2) We built a workaround into PyGaze, I just forgot to put it on GitHub. Will upload it first thing tomorrow!

    EDIT: Actually, on closer inspection, it seems like this is a slightly different error that I'm used to! (Don't worry, you'll also run into the above error in time ;) ) It seems like for whatever reason, the lxml library isn't installed. You can install it using the following command in a terminal:

    pip install lxml
    

    Alternatively, within OpenSesame, you can run the following in the Debug Window:

    import pip
    pip.main(["install", "lxml"])
    

    Cheers,
    Edwin

    Thanked by 1TomArmstrong
  • UPDATE: The GazePoint OpenGaze API malformed XML bug should be fixed with the latest commit. Grab the code of GitHub directly, and update your local PyGaze installation with it. See here: https://github.com/esdalmaijer/PyGaze

    Thanked by 1TomArmstrong
  • Thanks Edwin! I'm looking forward to using the GP3 :) I think I'm almost there. I ran that code in the debug window in OpenSesame, and here is what happened:

    Collecting lxml
      Using cached https://files.pythonhosted.org/packages/d7/ce/e5aa3dd8f9b402fee8407ce512c9d1440dd55254514fc12cfcd83c8c019e/lxml-4.2.5-cp27-cp27m-win32.whl
    Installing collected packages: lxml
    Exception:
    Traceback (most recent call last):
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\basecommand.py", line 215, in main
        status = self.run(options, args)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\commands\install.py", line 342, in run
        prefix=options.prefix_path,
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\req\req_set.py", line 784, in install
        **kwargs
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\req\req_install.py", line 851, in install
        self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
        isolated=self.isolated,
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
        clobber(source, lib_dir, True)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\wheel.py", line 316, in clobber
        ensure_dir(destdir)
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
        os.makedirs(path)
      File "C:\Program Files (x86)\OpenSesame\lib\os.py", line 157, in makedirs
        mkdir(name, mode)
    WindowsError: [Error 5] Access is denied: 'C:\\Program Files (x86)\\OpenSesame\\Lib\\site-packages\\lxml'
    You are using pip version 9.0.1, however version 18.1 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.
    

    I have admin privileges, so not sure what the issue is. I tried it through my command prompt with the other code and got this error:
    'pip' is not recognized as an internal or external command,
    operable program or batch file.

    Is my windows command prompt different than the terminal you had in mind? (Pardon my cluelessness/helplessness!) I tried the Python 3.4 command line, too, but no luck.

    Perhaps it was premature, but I moved on and replaced the opengaze.py and libopengaze.py files in my pygaze folder (within my OpenSesame folder) with the new versions on GitHub. Then I tried running OpenSesame with Opengaze as the tracker type and got this error:

    File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 157, in run
        exp.run()
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 456, 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 118, in __init__
        from pygaze._eyetracker.libopengaze import OpenGazeTracker
      File "C:\Program Files (x86)\OpenSesame\lib\site-packages\pygaze\_eyetracker\libopengaze.py", line 7
        <!DOCTYPE html>
        ^
    SyntaxError: invalid syntax
    

    Thanks for any advice you have!!

  • About pip in your command window: you probably need to add the path of your pip installation to the path system variable. Find the path to your pip. It will probably be in a folder like "C:\Python\Scripts", which is what I will use below as an example.
    Open your command window in your python folder (probably; I don't have much experience with python and windows) and type echo %PATH%. If the folder containing your pip installation is note there, you can add it with setx PATH "%PATH%; C:\Python\Scripts". Since this is Windows, you might have to restart your cmd window for any changes to take effect.

    About your second issue; if you download from git rather than clone, I noticed that one might run into formatting inconsistencies. Simply open the downloaded file in an editor and remove anything at the top that's not Python.

    Thanked by 2TomArmstrong Edwin
  • Thanks cesco! As you suspected, I did the GitHub download wrong. Now I am back to the 'No module named lxml.etree error'. So I just need to get the lxml library installed, which I will now try with your advice regarding the path...

  • I was able to install lmxl from the debug window once I ran OpenSesame as an administrator. Now I'm all set! Thanks everyone for your help! Very cool to see how the Gazepoint calibration routine plays out in PyGaze/OpenSesame! :)

  • Great to hear, Tom! :smile:

Sign In or Register to comment.