esdalmaijer / PyGaze

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments
www.pygaze.org
GNU General Public License v3.0
671 stars 211 forks source link

attributes construct error GP3 HD #115

Closed owngr closed 5 years ago

owngr commented 6 years ago

Hi,

I'm running your gazepoint experiment but I've found a problem in openGaze.py. The problem is not coming from pyGaze but from the constructor. I just post it there so people having the same problem know where it comes from.

attributes construct error, line 1, column 30 (line 1)
one msg didn't parse
<ACK ID="USER_DATA" VALUE="0"DUR="0" />

You can see the missing space between "0" and DUR. I wrote to the constructor hoping that they correct this. One work around can be to put command, msgdict = self._parse_msg(msg) in a try/catch in opengaze.py.

posipunk commented 6 years ago

I literally just ran into this issue last night and found a solution today. In opengaze.py you can add "import re" Then in function _parse_msg you can add line to top: xml = re.sub(r'(=\".+?\")', r'\1 ', xml) This will add a whitespace after every attribute and seems like a quick workaround

owngr commented 6 years ago

Nice workaround :) Gazept replied me, they took notes of it and it should be corrected in their next release.

esdalmaijer commented 6 years ago

Thanks for picking up on this and for contacting GazePoint @Olivierwenger, and for the workaround @posipunk! Much appreciated! :)

esdalmaijer commented 5 years ago

Initially I didn't implement this workaround, as I figured GazePoint would update their API soon after becoming aware of their bug, especially considering they already had a draft version where they fixed it. However, people still occasionally ask about this, so I decided to implement the workaround in the latest commit.

Thanks again for the suggestion!