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

Can't run the annoying_message.py example #29

Open Pithikos opened 9 years ago

Pithikos commented 9 years ago

Trying to run the annoying_message.py example with Python2.7 gives me this error:

manos@manos-530U3C:~/PyGaze/examples/annoying_message$ python annoying_message.py 
Traceback (most recent call last):
  File "annoying_message.py", line 18, in <module>
    disp = Display()
  File "/usr/local/lib/python2.7/dist-packages/pygaze/display.py", line 43, in __init__
    from pygaze._display.psychopydisplay import PsychoPyDisplay  as Display
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_display/psychopydisplay.py", line 30, in <module>
    from pygaze.libtime import clock
  File "/usr/local/lib/python2.7/dist-packages/pygaze/libtime.py", line 29, in <module>
    from pygaze._time.psychopytime import PsychoPyTime as Time
  File "/usr/local/lib/python2.7/dist-packages/pygaze/_time/psychopytime.py", line 22, in <module>
    import psychopy.core
ImportError: No module named psychopy.core

Trying to run it with Python3 gives me this error:

manos@manos-530U3C:~/PyGaze/examples/annoying_message$ python3 annoying_message.py 
Traceback (most recent call last):
  File "annoying_message.py", line 14, in <module>
    from pygaze.libscreen import Display, Screen
  File "/usr/local/lib/python3.3/dist-packages/pygaze/libscreen.py", line 22, in <module>
    from screen import Screen
ImportError: No module named 'screen'
esdalmaijer commented 9 years ago

Thanks for your feedback! The first (Python 2.7) error indicates you have not installed PsychoPy. Could this be true? To fix, add a file to the directory of the _annoyingmessage.py script called constants.py, and add DISPTYPE = 'pygame' (this switches the back-end to PyGame, but you could also opt for installing PsychoPy to fix your issue).

The second error indicates you have installed a version of PyGaze that is pre 0.5. To fix, import Screen and Display from the libscreen library: from libscreen import Display, Screen. BTW: PyGaze is tested on Python 2.7, because most of the dependencies only work on Python 2. I would not recommend using Python 3, unless you know that all of the dependencies you require run with Python 3.

Good luck!

DirkBroenink commented 6 years ago

esdalmaijer, would you still not recommend using PyGaze with Python 3? You made this statement 3 years ago, so I'm wondering if it's still relevant. We are about to start a project using pygaze. (We want to be able to use two different eye trackers and mouse input to see what parts of images are looked at.)