| Reference | Downloads | Github

Error when importing pyschopy on raspberry pi


I am running a few psychopy experiments on a Raspberry Pi. This has worked well in the past, until recently importing psychopy results in the following error. I am connecting to it with Putty over ssh:

Traceback (most recent call last):
File “”, line 5, in
from psychopy import visual, core, logging, event
File "/usr/local/lib/python2.7/dist-packages/PsychoPy-1.85.3-py2.7.egg/psychopy/visual/ ", line 17, in
from .window import Window, getMsPerFrame, openWindows
File “/usr/local/lib/python2.7/dist-packages/PsychoPy-1.85.3-py2.7.egg/psychopy/visual/”, line 57, in
from psychopy import core, platform_specific, logging, prefs, monitors, event
File “/usr/local/lib/python2.7/dist-packages/PsychoPy-1.85.3-py2.7.egg/psychopy/”, line 44 , in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/”, line 1896, in
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/gl/”, line 208, in create_sha dow_window
shadow_window = Window(width=1, height=1, visible=False)
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/xlib/”, line 166, in __ init

super(XlibWindow, self).init(*args, **kwargs)
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/”, line 501, in _init _
display = get_platform().get_default_display()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/”, line 1845, in get_de fault_display
return pyglet.canvas.get_display()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/canvas/”, line 82, in get_disp lay
return Display()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/canvas/”, line 86, in init
raise NoSuchDisplayException(‘Cannot connect to “%s”’ % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to “None”

This seems to be an issue with pyglet, but ive looked around and it sees that pyglet doesnt really play nice with RPi?