I have installed pyglet onto Mac OS X 10.7.4 using MacPorts.
pyglet only works when built for 32-bit archs so in order to use it I must run python from the command line like this,
arch -i386 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
And then I can successfully run the pyglet "hello world" program.
However, I like to use PyDev in Eclipse but I cannot work out how to configure PyDev to run python as a 32-bit process.
I have added the MacPorts python,
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
as a Python interpreter (Preferences > Pydev > Interpreter - Python). I have created a new project and set the MacPorts python as the project's interpreter. But when I run the pyglet "hello world" program from within this project, I get the following error
pydev debugger: starting
Traceback (most recent call last):
File "/Applications/eclipse/plugins/org.python.pydev.debug_1.6.2.2010090812/pysrc/pydevd.py", line 1145, in <module>
debugger.run(setup['file'], None, None)
File "/Applications/eclipse/plugins/org.python.pydev.debug_1.6.2.2010090812/pysrc/pydevd.py", line 916, in run
execfile(file, globals, locals) #execute the script
File "/Users/andrewfogg/Dropbox/EnvironmentalArt/src/art.py", line 2, in <module>
window = pyglet.window.Window()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pyglet/__init__.py", line 306, in __getattr__
__import__(import_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pyglet/window/__init__.py", line 1669, in <module>
from pyglet.window.carbon import CarbonPlatform, CarbonWindow
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pyglet/window/carbon/__init__.py", line 69, in <module>
framework='/System/Library/Frameworks/QuickTime.framework')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pyglet/lib.py", line 90, in load_library
return self.load_framework(kwargs['framework'])
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pyglet/lib.py", line 226, in load_framework
lib = ctypes.cdll.LoadLibrary(realpath)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/System/Library/Frameworks/QuickTime.framework/QuickTime, 6): no suitable image found. Did find:
/System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
/System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
Which would indicate that PyDev is running python as a 64-bit process.
I can see that I can have my python interpreter set environment variables (Preferences > Pydev > Interpreter - Python > Environment) but I am not sure how to correctly configure this (I have tried).
The question is: how do I run python as a 32-bit process in PyDev?