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

Communication Problem between Python and Gazepoint #102

Closed rajanpatel8 closed 5 years ago

rajanpatel8 commented 6 years ago

I am a university student researching about eye tracking data using Gazepoint device. I am trying to collect data from the Gazepoint using python program. I am using the python code that is provided by the website below. I have also downloaded all the packages required to run the program.

https://www.pygaze.org/2017/05/python-wrapper-for-gazepoints-opengaze-api/

However, it gives me a communication error when I try to run the program. I am attaching a screen shot of the error that it shows. Do anyone know what may be the reason for this error and how to debug it?

communication error

chalgand commented 6 years ago

Don't install pygaze by "pip install python-pygaze". You must be install pygaze after download the github project and install with "python setup.py install". (relaunch spyder if you use anaconda distribution)

rajanpatel8 commented 6 years ago

Thanks for your feedback chalgand. I have uninstalled pygaze by "pip uninstall python-pygaze". I have also downloaded the github project and tried to install pygaze with "python setup.py install". I am now getting the error shown below when I try that command.

capture

rajanpatel8 commented 6 years ago

I also tried to install it as an administrator and it did not give me any errors. However, when I run the program afterwards it says that there is "no module named pygaze.display" as shown below.

capture 2

chalgand commented 6 years ago

I had the same problem this morning. I uninstall and install from this github project. I re-run python. Administrator or not is not a problem. quit python between uninstall and re-install. my 2 cents

rajanpatel8 commented 6 years ago

Thanks for your input chalgand. I tried uninstalling and reinstalling this github project while quitting python. However, the administrator error message is still there when I command "python setup.py install". Do you happen to know how to debug this and install pygaze?

chalgand commented 6 years ago

Sorry for my simple answer : Do you have open cmd as administrator to execute "python setup.py install" as administrator ?

rajanpatel8 commented 6 years ago

Yes, I do have open cmd as administrator to execute that command. When I tried that command as an administrator it seemed to work, however it says "no module named pygaze.display" when I run the program so I don't think it is being installed correctly.

chalgand commented 6 years ago

It's just a problem of uninstall and install. Can you use a virutal environment ? Try it on other machine or virtual environment.

rajanpatel8 commented 6 years ago

Actually, I tried to use the command "setup.py install" without "python" and now I am getting an error that states that target machine refused the connection as shown below. Do you know what this error may be about? If it doesn't work, I might try it on a different machine like you suggested.

capture

chalgand commented 6 years ago

It's a good problem because I resolve this by using python code in the same time of "gazepoint control" is running. Python doesn't communicate with hardware.

esdalmaijer commented 6 years ago

As a general note: It's usually a bad idea to run scripts within an IDE. Ideally, you want to run them using the terminal or command prompt.

I see you're on Windows. This means you can create a batch file with the following code:

"C:\Python27\python.exe" "C:\Users\user\Desktop\Python Codes\Gazepoint.py"

pause

The first line will ask "python.exe" to run your script "Gazepoint.py". The second line "pause" will make sure the command prompt doesn't close until you press a key, thereby allowing you to see any error messages.

esdalmaijer commented 5 years ago

Closing this issue, as it's solved, and also not really a software issue. As a general note:

1) Always run the GazePoint server in the background; this is what PyGaze communicates with. The server handles the communication to the hardware.

2) Don't run your scripts from an IDE (editor), but instead run them from a terminal or command prompt (see example above).

3) If you came upon this thread due to an unrelated GazePoint issue, it's likely you're looking for a fix to GazePoint's OpenGaze API malformed XML bug. A workaround was implemented in this commit. Downloading the latest version of PyGaze will likely solve your issue. (Alternatively, contact GazePoint, as they have a pre-build of their API without the malformed XML bug.)