I am trying to use psychopy for a user study, I have tried to run the standalone psychopy which works fine however I can not use the standalone application as i use python to run a separate device hence the need of running everything within python.
I have the latest psychopy version 3.10 installed
System MacOS High Sierra
Below is the error I get when i try to run my script, I have ran each import individually so that I can copy the error message.
from psychopy import event
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/site-packages/psychopy/event.py”, line 63, in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “/usr/local/lib/python2.7/site-packages/pyglet/window/init.py”, line 1896, in
gl._create_shadow_window()
File “/usr/local/lib/python2.7/site-packages/pyglet/gl/init.py”, line 208, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File “/usr/local/lib/python2.7/site-packages/pyglet/window/init.py”, line 497, in init
EventDispatcher.init(self)
TypeError: expected string or buffer
from psychopy import visual
pygame 1.9.6
Hello from the pygame community. Contribute - pygame wiki
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/site-packages/psychopy/visual/init.py”, line 26, in
from .text import TextStim
File “/usr/local/lib/python2.7/site-packages/psychopy/visual/text.py”, line 29, in
import psychopy.event
File “/usr/local/lib/python2.7/site-packages/psychopy/event.py”, line 63, in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “/usr/local/lib/python2.7/site-packages/pyglet/window/init.py”, line 1896, in
gl._create_shadow_window()
File “/usr/local/lib/python2.7/site-packages/pyglet/gl/init.py”, line 208, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File “/usr/local/lib/python2.7/site-packages/pyglet/window/init.py”, line 501, in init
display = get_platform().get_default_display()
File “/usr/local/lib/python2.7/site-packages/pyglet/window/init.py”, line 1845, in get_default_display
return pyglet.canvas.get_display()
File “/usr/local/lib/python2.7/site-packages/pyglet/canvas/init.py”, line 77, in get_display
from pyglet.app import displays
File “/usr/local/lib/python2.7/site-packages/pyglet/app/init.py”, line 175, in
event_loop = EventLoop()
File “/usr/local/lib/python2.7/site-packages/pyglet/app/base.py”, line 119, in init
self.clock = clock.get_default()
File “/usr/local/lib/python2.7/site-packages/pyglet/init.py”, line 384, in getattr
import(import_name)
File “/usr/local/lib/python2.7/site-packages/pyglet/clock.py”, line 169, in
_c = pyglet.lib.load_library(‘c’)
File “/usr/local/lib/python2.7/site-packages/pyglet/lib.py”, line 158, in load_library
raise ImportError(‘Library “%s” not found.’ % names[0])
ImportError: Library “c” not found.
I have spent time searching for some explanation for how to fix the error and am yet to get some help. Any indication as to why this is will be very much appreciated. The above error is only generated when i run my script from the terminal with python 2. with python 3.7 the error message is that there is no module named psychopy.