Hello,
I am trying to use pyglet with psychopy to create a psychology experiment
but am running into all sorts of issues.
I used macports to install python2.6 and psychopy in
/opt/local/bin/python2.6 on OS X 10.9
I'm running everything in pyCharm using the python interperter in
/opt/local/bin.
I've also installed pyglet 1.2alpha1 and updated XQuartz to the newest
version.
If I try to run
from pyglet.window import Window
I see that python tries to launch but nothing happens.
Typing
from pyglet import app
app.run()
Just freezes up the terminal (the prompt disappears)
All I want is for this simple code to run:
from psychopy import core, visual
import pyglet
#Create a window
win = visual.Window([400,300])
#Create a stimulus for a certain window
message = visual.TextStim(win, text='Hello World!')
# Draw the stimulus to the window
message.draw()
# Flip backside of the window
win.flip()
#Pause 5s so you get a chance to see it
core.wait(5.0)
But I get this error message:
/opt/local/bin/python2.6
/Users/shadyeldamaty/PycharmProjects/ultimatgame/psypy1.py
/Users/shadyeldamaty/.local/lib/python2.6/site-packages/psychopy/visual/helpers.py:176:
FutureWarning: comparison to `None` will result in an elementwise object
comparison in the future.
if color==None:
Traceback (most recent call last):
File "/Users/shadyeldamaty/PycharmProjects/ultimatgame/psypy1.py", line
14, in <module>
win = visual.Window([400,300])
File
"/Users/shadyeldamaty/.local/lib/python2.6/site-packages/psychopy/visual/window.py",
line 320, in __init__
self._setupGL()
File
"/Users/shadyeldamaty/.local/lib/python2.6/site-packages/psychopy/visual/window.py",
line 1338, in _setupGL
self._setupPyglet()
File
"/Users/shadyeldamaty/.local/lib/python2.6/site-packages/psychopy/visual/window.py",
line 1212, in _setupPyglet
self._hw_handle=self.winHandle._window.value
AttributeError: 'CocoaWindow' object has no attribute '_window'
1.6892 WARNING Creating new monitor...
1.6894 WARNING Creating new monitor...
Process finished with exit code 1
I've tried running the above code in 32bit mode in Canopy with arch -386
python and this doesn't work either.
from pyglet import app
app.run()
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-14-810b1526bc66> in <module>()
----> 1 app.run()
/Users/shadyeldamaty/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyglet/__init__.py
in __getattr__(self, name)
304
305 import_name = 'pyglet.%s' % self._module_name
--> 306 __import__(import_name)
307 module = sys.modules[import_name]
308 object.__setattr__(self, '_module', module)
/Users/shadyeldamaty/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyglet/app/__init__.pyc
in <module>()
289
290 if sys.platform == 'darwin':
--> 291 from pyglet.app.carbon import CarbonEventLoop as EventLoop
292 elif sys.platform in ('win32', 'cygwin'):
293 from pyglet.app.win32 import Win32EventLoop as EventLoop
/Users/shadyeldamaty/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyglet/app/carbon.py
in <module>()
42
43 from pyglet.app import windows, BaseEventLoop
---> 44 from pyglet.window.carbon import carbon, types, constants, _oscheck
45
46 EventLoopTimerProc = ctypes.CFUNCTYPE(None, ctypes.c_void_p,
ctypes.c_void_p)
/Users/shadyeldamaty/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyglet/window/__init__.py
in <module>()
1667 # Try to determine which platform to use.
1668 if sys.platform == 'darwin':
-> 1669 from pyglet.window.carbon import CarbonPlatform,
CarbonWindow
1670 _platform = CarbonPlatform()
1671 Window = CarbonWindow
/Users/shadyeldamaty/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyglet/window/carbon/__init__.py
in <module>()
47 from pyglet.window import WindowException, Platform, Display,
Screen, 48 BaseWindow, MouseCursor, DefaultMouseCursor,
_PlatformEventHandler
---> 49 from pyglet.window import key
50 from pyglet.window import mouse
51 from pyglet.window import event
ImportError: cannot import name key
Can you please help me debug why pyglet will not work on my system and if
possible how to get the psychopy script above to work? I've been working
on this issue for about 8 hours now and have tried everything I could find
online.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.