Howdy, Stranger!

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

Supported by

GazePoint - OpenSesame: lxml.etree.XMLSyntaxError extracontent

Hi everyone!

I am a 1st year PhD student at La Sapienza University of Rome and I am using OpenSesame 3.3.14 running with Python 3.7 and GazePoint 6.9.0.

In my experiments including PyGaze, I start by downloading the lxml library as suggested in a previous thread (https://forum.cogsci.nl/discussion/4171/gazepoint-control-version-4-2-0-used-with-pygaze-and-opensesame-calibration-error).

However, when running any of the PyGaze experiments (with admin privileges), I got the following exception:

Exception in thread PyGaze_OpenGazeConnection_incoming:
Traceback (most recent call last):
 File "C:\Program Files (x86)\OpenSesame\lib\threading.py", line 926, in _bootstrap_inner
  self.run()
 File "C:\Program Files (x86)\OpenSesame\lib\threading.py", line 870, in run
  self._target(*self._args, **self._kwargs)
 File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\pygaze\_eyetracker\opengaze.py", line 412, in _process_incoming
  command, msgdict = self._parse_msg(msg)
 File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\pygaze\_eyetracker\opengaze.py", line 335, in _parse_msg
  e = lxml.etree.fromstring(xml)
 File "src\lxml\etree.pyx", line 3257, in lxml.etree.fromstring
 File "src\lxml\parser.pxi", line 1916, in lxml.etree._parseMemoryDocument
 File "src\lxml\parser.pxi", line 1796, in lxml.etree._parseDoc
 File "src\lxml\parser.pxi", line 1085, in lxml.etree._BaseParser._parseUnicodeDoc
 File "src\lxml\parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
 File "src\lxml\parser.pxi", line 728, in lxml.etree._handleParseResult
 File "src\lxml\parser.pxi", line 657, in lxml.etree._raiseParseError
 File "<string>", line 2
lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 2, column 1

[ Note: in other cases, apparently randomly, the last line of the exception is lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1]


So it seems like there is an issue when reading/writing the xml file with the gaze coordinates.

Actually, the experiment keeps going, however it keeps lagging and bugging, being overall extremely slow. The bug starts from the calibration phase.

Can anybody help me to figure this out?

Thanks

Elena

Comments

  • Hi @_elena_ ,

    Thanks for reporting this! We've done quite a bit of work on improving support for the GazePoint, but it's still pretty rocky. As a first step, let's try to figure out where this error comes from. If you open C:\Program Files (x86)\OpenSesame\Lib\site-packages\pygaze\_eyetracker\opengaze.py in a text editor and modify _parse_msg() around line 335 like this:

        def _parse_msg(self, xml):
          
    #        # Fix for GazePoint API bug.
    #          if xml == '<ACK ID="USER_DATA" VALUE="0"DUR="0" />':
    #            xml = '<ACK ID="USER_DATA" VALUE="0" DUR="0" />'
            # Attempt to fix all malformed XML strings. (GazePoint frequently
            # manages to send malformed XML messages, which causes an error for
            # lxml decoding.)
            xml = re.sub(r'(=".+?")', r'\1 ', xml)
    
            # Parse the xml string.
    
            try:
                e = lxml.etree.fromstring(xml)
            except Exception as e:
                print('*** The following XML message was malformed ***')
                print(xml)
                print('*** End of XML message ***')
                raise
       
            return (e.tag, e.attrib)
    

    This won't fix the issue, but it will print out the offending XML message. This should help to see what's wrong.

    — Sebastiaan

  • Hi @sebastiaan!

    Thanks for your quickly reply :)

    This is what I got after modifying "_parse_msg()":

    *** The following XML message was malformed ***
    <REC CNT="1069918" TIME="7447.88281" TIME_TICK="82736671093" FPOGX="0.52525" FPOGY="0.57212" FPOGS="7447.65430" FPOGD="0.22852" FPOGID="11391" FPOGV="1" LPOGX="0.51855" LPOGY="0.61747" LPOGV="1" RPOGX="0.54457" RPOGY="0.56290" RPOGV="1" BPOGX="0.53156" BPOGY="0.59018" BPOGV="1" LPCX="0.44186" LPCY="0.73574" LPD="30.42367" LPS="0.91786" LPV="1" RPCX="0.63725" RPCY="0.74466" RPD="29.81335" RPS="0.92636" RPV="1" LEYEX="-0.01599" LEYEY="-0.05295" LEYEZ="0.71316" LPUPILD="0.00805" LPUPILV="1" REYEX="0.03887" REYEY="-0.05677" REYEZ="0.74060" RPUPILD="0.00780" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />
    <REC CNT="1069919" TIME="7447.88867" TIME_TICK="82736733574" FPOGX="0.52529" FPOGY="0.57257" FPOGS="7447.65430" FPOGD="0.23438" FPOGID="11391" FPOGV="1" LPOGX="0.54452" LPOGY="0.60177" LPOGV="1" RPOGX="0.50877" RPOGY="0.57459" RPOGV="1" BPOGX="0.52664" BPOGY="0.58818" BPOGV="1" LPCX="0.44204" LPCY="0.73570" LPD="30.33233" LPS="0.94236" LPV="1" RPCX="0.63741" RPCY="0.74462" RPD="30.11010" RPS="0.95830" RPV="1" LEYEX="-0.01599" LEYEY="-0.05295" LEYEZ="0.71316" LPUPILD="0.00803" LPUPILV="1" REYEX="0.03887" REYEY="-0.05677" REYEZ="0.74060" RPUPILD="0.00781" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />
    *** End of XML message ***
    

    Regards,

    Elena

  • @_elena_ Thanks. It seems that the xml string contains two messages, rather than one, probably because they haven't been properly split. I think that's easy to fix, but again you'll have to test this for me because I don't experience this myself (maybe because for some reason messages rarely need to be split on our system). Around line 395 in opengaze.py you will see this:

    # Split the messages (they are separated by '\r\n').
    messages = instring.split('\r\n')
    

    Change this to:

    # Split string into separate messages 
    messages = instring.splitlines()
    

    Does this resolve the issue? (Or at least this particular issue.)

  • @sebastiaan thank you again!

    Unfortunately, after this replacement, I ran the experiment several times but the error message was always lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1.

    By contrast, I haven't seen the message lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 2, column 1since I made this last change.

  • Hi @sebastiaan,

    trying to figure out where the problem is, I printed the message to the console. It seems that something irregular is going on in splitting strings (see attached for the entire console output):

    ['<REC CNT="340379" TIME="2299.14429" TIME_TICK="224292265700" FPOGX="0.46053" FPOGY="0.27929" FPOGS="2299.11255" FPOGD="0.03174" FPOGID="2506" FPOGV="1" LPOGX="0.46279" LPOGY="0.33567" LPOGV="1" RPOGX="0.44331" RPOGY="0.26925" RPOGV="1" BPOGX="0.45305" BPOGY="0.30246" BPOGV="1" LPCX="0.47036" LPCY="0.66027" LPD="30.04051" LPS="0.97653" LPV="1" RPCX="0.68892" RPCY="0.67030" RPD="23.21783" RPS="0.97653" RPV="1" LEYEX="-0.00684" LEYEY="-0.03213" LEYEZ="0.62094" LPUPILD="0.00708" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00758" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340380" TIME="2299.15039" TIME_TICK="224292327355" FPOGX="0.45929" FPOGY="0.28315" FPOGS="2299.11255" FPOGD="0.03784" FPOGID="2506" FPOGV="1" LPOGX="0.46279" LPOGY="0.33567" LPOGV="1" RPOGX="0.44331" RPOGY="0.26925" RPOGV="1" BPOGX="0.45305" BPOGY="0.30246" BPOGV="1" LPCX="0.47035" LPCY="0.66029" LPD="29.92834" LPS="0.97653" LPV="1" RPCX="0.68857" RPCY="0.67068" RPD="23.58795" RPS="0.97653" RPV="1" LEYEX="-0.00702" LEYEY="-0.03226" LEYEZ="0.61980" LPUPILD="0.00710" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00772" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340381" TIME="2299.15698" TIME_TICK="224292393965" FPOGX="0.46192" FPOGY="0.28230" FPOGS="2299.11255" FPOGD="0.04443" FPOGID="2506" FPOGV="1" LPOGX="0.51008" LPOGY="0.36696" LPOGV="1" RPOGX="0.44540" RPOGY="0.18742" RPOGV="1" BPOGX="0.47774" BPOGY="0.27719" BPOGV="1" LPCX="0.47015" LPCY="0.66071" LPD="29.99151" LPS="0.97653" LPV="1" RPCX="0.68839" RPCY="0.67113" RPD="23.53635" RPS="0.97653" RPV="1" LEYEX="-0.00702" LEYEY="-0.03226" LEYEZ="0.61980" LPUPILD="0.00711" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00753" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340382" TIME="2299.16528" TIME_TICK="224292476617" FPOGX="0.46205" FPOGY="0.28361" FPOGS="2299.11255" FPOGD="0.05273" FPOGID="2506" FPOGV="1" LPOGX="0.50274" LPOGY="0.39142" LPOGV="1" RPOGX="0.42317" RPOGY="0.19415" RPOGV="1" BPOGX="0.46295" BPOGY="0.29278" BPOGV="1" LPCX="0.47007" LPCY="0.66092" LPD="29.95748" LPS="0.97653" LPV="1" RPCX="0.68855" RPCY="0.67110" RPD="23.43290" RPS="0.97653" RPV="1" LEYEX="-0.00702" LEYEY="-0.03226" LEYEZ="0.61980" LPUPILD="0.00708" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00744" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340383" TIME="2299.17041" TIME_TICK="224292527241" FPOGX="0.46207" FPOGY="0.28582" FPOGS="2299.11255" FPOGD="0.05786" FPOGID="2506" FPOGV="1" LPOGX="0.50250" LPOGY="0.39784" LPOGV="1" RPOGX="0.42189" RPOGY="0.20916" RPOGV="1" BPOGX="0.46220" BPOGY="0.30350" BPOGV="1" LPCX="0.47000" LPCY="0.66091" LPD="29.77049" LPS="0.97039" LPV="1" RPCX="0.68825" RPCY="0.67129" RPD="23.61155" RPS="0.96432" RPV="1" LEYEX="-0.00695" LEYEY="-0.03137" LEYEZ="0.60191" LPUPILD="0.00713" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00757" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340384" TIME="2299.17725" TIME_TICK="224292595517" FPOGX="0.46199" FPOGY="0.29081" FPOGS="2299.11255" FPOGD="0.06470" FPOGID="2506" FPOGV="1" LPOGX="0.48914" LPOGY="0.39360" LPOGV="1" RPOGX="0.43353" RPOGY="0.27774" RPOGV="1" BPOGX="0.46134" BPOGY="0.33567" BPOGV="1" LPCX="0.46991" LPCY="0.66133" LPD="29.77080" LPS="0.95818" LPV="1" RPCX="0.68823" RPCY="0.67158" RPD="23.14947" RPS="0.95212" RPV="1" LEYEX="-0.00695" LEYEY="-0.03137" LEYEZ="0.60191" LPUPILD="0.00708" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00764" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340385" TIME="2299.18384" TIME_TICK="224292661976" FPOGX="0.46128" FPOGY="0.29756" FPOGS="2299.11255" FPOGD="0.07129" FPOGID="2506" FPOGV="1" LPOGX="0.44663" LPOGY="0.37718" LPOGV="1" RPOGX="0.46159" RPOGY="0.35301" RPOGV="1" BPOGX="0.45411" BPOGY="0.36510" BPOGV="1" LPCX="0.46981" LPCY="0.66145" LPD="29.81265" LPS="0.94598" LPV="1" RPCX="0.68815" RPCY="0.67190" RPD="23.17918" RPS="0.939']
    ['91" RPV="1" LEYEX="-0.00695" LEYEY="-0.03137" LEYEZ="0.60191" LPUPILD="0.00707" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00759" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340386" TIME="2299.19043" TIME_TICK="224292728757" FPOGX="0.46068" FPOGY="0.30346" FPOGS="2299.11255" FPOGD="0.07788" FPOGID="2506" FPOGV="1" LPOGX="0.44675" LPOGY="0.38374" LPOGV="1" RPOGX="0.46159" RPOGY="0.35301" RPOGV="1" BPOGX="0.45417" BPOGY="0.36838" BPOGV="1" LPCX="0.46979" LPCY="0.66152" LPD="29.73737" LPS="0.93991" LPV="1" RPCX="0.68805" RPCY="0.67192" RPD="22.81437" RPS="0.93991" RPV="1" LEYEX="-0.00729" LEYEY="-0.03293" LEYEZ="0.62730" LPUPILD="0.00710" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00769" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340387" TIME="2299.19849" TIME_TICK="224292809206" FPOGX="0.46121" FPOGY="0.30445" FPOGS="2299.11255" FPOGD="0.08594" FPOGID="2506" FPOGV="1" LPOGX="0.46914" LPOGY="0.38517" LPOGV="1" RPOGX="0.46590" RPOGY="0.24751" RPOGV="1" BPOGX="0.46752" BPOGY="0.31634" BPOGV="1" LPCX="0.46970" LPCY="0.66202" LPD="29.68973" LPS="0.94605" LPV="1" RPCX="0.68779" RPCY="0.67231" RPD="23.18755" RPS="0.95212" RPV="1" LEYEX="-0.00729" LEYEY="-0.03293" LEYEZ="0.62730" LPUPILD="0.00710" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00749" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340388" TIME="2299.20386" TIME_TICK="224292860973" FPOGX="0.46098" FPOGY="0.30467" FPOGS="2299.11255" FPOGD="0.09131" FPOGID="2506" FPOGV="1" LPOGX="0.47112" LPOGY="0.32928" LPOGV="1" RPOGX="0.44496" RPOGY="0.28563" RPOGV="1" BPOGX="0.45804" BPOGY="0.30746" BPOGV="1" LPCX="0.46960" LPCY="0.66228" LPD="29.88498" LPS="0.95826" LPV="1" RPCX="0.68761" RPCY="0.67257" RPD="22.92623" RPS="0.96432" RPV="1" LEYEX="-0.00729" LEYEY="-0.03293" LEYEZ="0.62730" LPUPILD="0.00709" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00749" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340389" TIME="2299.21118" TIME_TICK="224292934853" FPOGX="0.46084" FPOGY="0.30393" FPOGS="2299.11255" FPOGD="0.09863" FPOGID="2506" FPOGV="1" LPOGX="0.47119" LPOGY="0.31558" LPOGV="1" RPOGX="0.44654" RPOGY="0.27160" RPOGV="1" BPOGX="0.45887" BPOGY="0.29359" BPOGV="1" LPCX="0.46960" LPCY="0.66226" LPD="29.47772" LPS="0.97046" LPV="1" RPCX="0.68779" RPCY="0.67249" RPD="22.75346" RPS="0.97653" RPV="1" LEYEX="-0.00716" LEYEY="-0.03285" LEYEZ="0.62387" LPUPILD="0.00710" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00737" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340390" TIME="2299.21777" TIME_TICK="224293001011" FPOGX="0.46052" FPOGY="0.30309" FPOGS="2299.11255" FPOGD="0.10522" FPOGID="2506" FPOGV="1" LPOGX="0.46699" LPOGY="0.32267" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="1" BPOGX="0.45570" BPOGY="0.29046" BPOGV="1" LPCX="0.46962" LPCY="0.66267" LPD="29.72878" LPS="0.97653" LPV="1" RPCX="0.68735" RPCY="0.67285" RPD="22.67678" RPS="0.97653" RPV="1" LEYEX="-0.00716" LEYEY="-0.03285" LEYEZ="0.62387" LPUPILD="0.00714" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00762" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340391" TIME="2299.22363" TIME_TICK="224293059125" FPOGX="0.46101" FPOGY="0.30607" FPOGS="2299.11255" FPOGD="0.11108" FPOGID="2506" FPOGV="1" LPOGX="0.46888" LPOGY="0.35385" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.46888" BPOGY="0.35385" BPOGV="1" LPCX="0.46964" LPCY="0.66308" LPD="29.80216" LPS="0.97653" LPV="1" RPCX="0.68762" RPCY="0.67296" RPD="22.52425" RPS="0.97653" RPV="1" LEYEX="-0.00716" LEYEY="-0.03285" LEYEZ="0.62387" LPUPILD="0.00707" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00738" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340392" TIME="2299.23071" TIME_TICK="224293131290" FPOGX="0.46145" FPOGY="0.30832" FPOGS="2299.11255" FPOGD="0.11816" FPOGID="2506" FPOGV="1" LPOGX="0.46891" LPOGY="0.34651" ']
    ['LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.46891" BPOGY="0.34651" BPOGV="1" LPCX="0.46959" LPCY="0.66313" LPD="29.87591" LPS="0.98335" LPV="1" RPCX="0.68770" RPCY="0.67327" RPD="22.34492" RPS="0.99010" RPV="1" LEYEX="-0.00733" LEYEY="-0.03353" LEYEZ="0.63497" LPUPILD="0.00709" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00734" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340393" TIME="2299.23706" TIME_TICK="224293194595" FPOGX="0.46443" FPOGY="0.30833" FPOGS="2299.11255" FPOGD="0.12451" FPOGID="2506" FPOGV="1" LPOGX="0.51806" LPOGY="0.30858" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.51806" BPOGY="0.30858" BPOGV="1" LPCX="0.47020" LPCY="0.66377" LPD="29.59719" LPS="0.99692" LPV="1" RPCX="0.68780" RPCY="0.67387" RPD="22.26028" RPS="1.00366" RPV="1" LEYEX="-0.00733" LEYEY="-0.03353" LEYEZ="0.63497" LPUPILD="0.00718" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00755" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340394" TIME="2299.24561" TIME_TICK="224293279861" FPOGX="0.46707" FPOGY="0.31172" FPOGS="2299.11255" FPOGD="0.13306" FPOGID="2506" FPOGV="1" LPOGX="0.51721" LPOGY="0.37611" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.51721" BPOGY="0.37611" BPOGV="1" LPCX="0.47088" LPCY="0.66450" LPD="29.94874" LPS="1.01048" LPV="1" RPCX="0.68818" RPCY="0.67434" RPD="22.42010" RPS="1.01722" RPV="1" LEYEX="-0.00733" LEYEY="-0.03353" LEYEZ="0.63497" LPUPILD="0.00718" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00755" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340395" TIME="2299.25049" TIME_TICK="224293329375" FPOGX="0.46949" FPOGY="0.31412" FPOGS="2299.11255" FPOGD="0.13794" FPOGID="2506" FPOGV="1" LPOGX="0.51793" LPOGY="0.36215" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.51793" BPOGY="0.36215" BPOGV="1" LPCX="0.47103" LPCY="0.66467" LPD="29.93581" LPS="1.02405" LPV="1" RPCX="0.68849" RPCY="0.67475" RPD="22.85591" RPS="1.03079" RPV="1" LEYEX="-0.00765" LEYEY="-0.03626" LEYEZ="0.67997" LPUPILD="0.00720" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00732" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340396" TIME="2299.25708" TIME_TICK="224293394242" FPOGX="0.47108" FPOGY="0.31491" FPOGS="2299.11255" FPOGD="0.14453" FPOGID="2506" FPOGV="1" LPOGX="0.50436" LPOGY="0.33133" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.50436" BPOGY="0.33133" BPOGV="1" LPCX="0.47121" LPCY="0.66534" LPD="29.42110" LPS="1.03079" LPV="1" RPCX="0.68870" RPCY="0.67572" RPD="23.10736" RPS="1.03079" RPV="1" LEYEX="-0.00765" LEYEY="-0.03626" LEYEZ="0.67997" LPUPILD="0.00718" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00731" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340397" TIME="2299.26416" TIME_TICK="224293465637" FPOGX="0.47275" FPOGY="0.31674" FPOGS="2299.11255" FPOGD="0.15161" FPOGID="2506" FPOGV="1" LPOGX="0.50950" LPOGY="0.35721" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.50950" BPOGY="0.35721" BPOGV="1" LPCX="0.47125" LPCY="0.66556" LPD="29.70737" LPS="1.03079" LPV="1" RPCX="0.68862" RPCY="0.67598" RPD="23.12533" RPS="1.03079" RPV="1" LEYEX="-0.00765" LEYEY="-0.03626" LEYEZ="0.67997" LPUPILD="0.00713" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00723" RPUPILV="1" CX="0.50000" CY="0.50000" CS="0" USER="" />', '<REC CNT="340398" TIME="2299.27075" TIME_TICK="224293531594" FPOGX="0.47428" FPOGY="0.31843" FPOGS="2299.11255" FPOGD="0.15820" FPOGID="2506" FPOGV="1" LPOGX="0.50950" LPOGY="0.35721" LPOGV="1" RPOGX="0.44441" RPOGY="0.25825" RPOGV="0" BPOGX="0.50950" BPOGY="0.35721" BPOGV="1" LPCX="0.47130" LPCY="0.66565" LPD="29.93364" LPS="1.03079" LPV="1" RPCX="0.68880" RPCY="0.67602" RPD="23.08718" RPS="1.03079" RPV="1" LEYEX="-0.00716" LEYEY="-0.03461" LEYEZ="0.64544" LPUPILD="0.00710" LPUPILV="1" REYEX="0.04473" REYEY="-0.03425" REYEZ="0.61955" RPUPILD="0.00715" RPUPILV="1" CX="0.50000" ']
    

    Using both versions of the message (instring.split('\r\n') and instring.splitlines()) I got the same output.

    Hope this can help you.

    Thanks,

    Elena

  • Hi @_elena_ ,

    It's still difficult to tackle this, because I don't experience the issues myself. (Although I do experience the slowness, which is annoying.) What version of the OpenGaze SDK are you using? The latest version at the time of writing is 6.9.0, which is also what I'm using.

    The fact that the messages are split is not the issue, or at least I don't think so. This simply results from the fact that messages arrive in chunks, which are then re-assembled.

    Instead, the error message that you now see:

    lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1.
    

    Is due to a message being completely empty. Perhaps this can be resolved simply by removing all empty lines during splitting, like so (again around line 395 in opengaze.py):

    # Split messages and remove empty messages
    messages = [msg for msg instring.splitlines() if msg.strip()]
    

    — Sebastiaan

  • Hi @sebastiaan, thank you again!

    This line solved the problem regarding the error message:

    lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1.
    

    However, the experiment keeps lagging with my gaze contingency inline_script and runs correctly when I remove it (maybe the problem is due to if statements and while loops to be executed) .

    I am programming an eye-tracking change-detection experiment using the inline_script object to set a gaze-contingent duration of the encoding phase:

    # define variables
    x2 = var.x_center_bb
    y2 = var.y_center_bb
    w = var.width_bb
    h = var.height_bb
    name_image = var.item
    
    
    # bounding box coordinates:
    print(x2)
    print(y2)
    print(w)
    print(h)
    
    # item name:
    print(var.encoding)
    
    # thresholds:
    timeout_ms = 10000 # ms
    required_fixation_duration = 200 #ms
    
    #counters:
    count_contains = 0
    count_trials = 0
    
    # time stamp before starting the check:
    overall_starting_time = clock.time() # overall timeout
    time_end = clock.time() # end of contains loop
    ending_time = overall_starting_time + timeout_ms # end of the trial
    
    # Flags used to keep running (or breaking from) the loop:
    keep_running = True
    while_flag = False
    if_flag = True
    
    # start the while loop:
    while keep_running:
    count_trials = count_trials +1
    timestamp = clock.time()
    overall_time_passed = timestamp - overall_starting_time # get overall duration:
    # if check took more than 10 s:
    if overall_time_passed > timeout_ms:
    print("Trial timed out")
    keep_running = False # time out (break from loop)
    break
    
    #get eye position
    x, y = exp.pygaze_eyetracker.sample()
    
    if if_flag:
    if contains(x,y,x2,y2,w,h): #check if the gaze is in the bounding box
    start_fixation_timing = clock.time()
    print(w)
    print(h)
    while contains(x,y,x2,y2,w,h): # start the contains loop
    eyetracker.log("gaze in") # message to tsv file
    x, y = exp.pygaze_eyetracker.sample()
    print(x, "line 58", "x")
    print(y, "line 59", "y")
    timestamp = clock.time()
    #if check took more than 10 s:
    if overall_time_passed > timeout_ms:
    print("time out")
    keep_running = False #time out (break from loop)
    break
    else:
    fixation_time = clock.time() - start_fixation_timing
    count_contains = count_contains +1
    print (count_contains, "line 69", "gaze in")
    if fixation_time > required_fixation_duration:
    eyetracker.log("end contains")
    print (fixation_time, "line 72", "contains done")
    time_end = clock.time()
    print (time_end, "line 74", "time end")
    ending_time = time_end + 2000
    print (ending_time, "line 76", "ending time")
    if_flag = False
    break
    
    if not if_flag:
    time_end = clock.time()
    #if check took more than 2 s:
    if ending_time < time_end:
    print (ending_time, time_end, "line 84","ending_time","time_end")
    print ("end trial")
    print (count_trials, "line 86", "samples total")
    print (count_contains, "line 87", "samples in")
    counter = count_contains/count_trials
    print (counter, "line 89", "percentage gaze in")
    keep_running = False
    break
    

    contains() function is defined in another inline_script as helper function:

    def contains(x,y,x2,y2,w,h):
    """checks whether point (x,y) is in rect defined through x2,y2, w,h """
    if x > x2 - w/2 and x < x2 + w/2 and y > y2 - h/2 and y < y2 + h/2:
    return True
    else:
    return False
    

    The experiment runs and finishes correctly on a laptop which is much less performing than the pc where I'm experiencing this issue. Of course, versions of Windows, OpenSesame and GazePoint are the same in both computers.

    I still can't figure out what's the problem.

    Thank you in advance,

    Elena

  • Hi @elena ,

    However, the experiment keeps lagging with my gaze contingency inline_script and runs correctly when I remove it (maybe the problem is due to if statements and while loops to be executed) . (…) The experiment runs and finishes correctly on a laptop which is much less performing than the pc where I'm experiencing this issue.

    To narrow the issue down (if you haven't already), I would first test the gaze-contingency in the experiment with advanced dummy mode in pygaze_init . If the experiment also reacts slowly to the eye movements (which I assume is what you mean with laggy?) when the GazePoint is not connected, then clearly the problem is not the GazePoint. But if the experiment only reacts slowly when it is actually connected to the GazePoint, then of course the issue lies there.

    — Sebastiaan

  • Hi @sebastiaan, thank you again!

    With advance dummy mode the experiment with gaze-contingency script runs correclty, therefore the problem concerns the connection with GazePoint.

    Could you please give me some guidance on this issue?

    Regards,

    Elena

  • Hi @sebastiaan,

    I finally managed to run the experiment on a third PC and the line

    messages = msg for msg in instring.splitlines() if msg.strip()]
    

    was essential to make it work properly. I think the issue was linked to the touchscreen monitor.

    Anyway, hope this information can be useful to you.

    I will be back in touch if there are other problems.

    Thanks a lot.

    Cheers,

    Elena

  • @_elena_ Thanks, this is very useful 👍️ We'll include that fix in the next maintenance release of PyGaze.

  • Hi @sebastiaan,

    I’m writing on this thread cause I’m having other issues with this experiment.

    After all your suggestions, I managed to get it to run correctly on a pc (Windows 11, OpenSesame 3.3.14, GazePoint 6.9.0)

    However, with another pc (same Windows, OpenSesame and GazePoint versions) the experiment runs correctly for some trials but then slows down (like few months ago) and I get the following error message on the console:

    Exception in thread PyGaze_OpenGazeConnection_incoming:
    Traceback (most recent call last):
     File "C:\Program Files (x86)\OpenSesame\lib\threading.py", line 926, in _bootstrap_inner
      self.run()
     File "C:\Program Files (x86)\OpenSesame\lib\threading.py", line 870, in run
      self._target(*self._args, **self._kwargs)
     File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\pygaze\_eyetracker\opengaze.py", line 405, in _process_incoming
      if not messages[-1][-2:] == '/>':
    IndexError: list index out of range
    

    There should be some problem with the PyGaze library, but I can't figure out exactly what is it.

    Could you please help me with this issue?

    Thanks in advance,

    Elena

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games