psychopy.org | Reference | Downloads | Github

Error when importing pyschopy on raspberry pi

Hello,

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 “marmobox.py”, 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/init.py ", 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/window.py”, 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/event.py”, line 44 , in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/init.py”, line 1896, in
gl._create_shadow_window()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/gl/init.py”, 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/init.py”, line 166, in __ init

super(XlibWindow, self).init(*args, **kwargs)
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/init.py”, line 501, in _init _
display = get_platform().get_default_display()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/window/init.py”, line 1845, in get_de fault_display
return pyglet.canvas.get_display()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/canvas/init.py”, line 82, in get_disp lay
return Display()
File “/home/pi/.local/lib/python2.7/site-packages/pyglet/canvas/xlib.py”, 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?