A few months ago, I been successfully using TM for all sorts of Python scripts. I recently decided to use it again, but now scripts that used to run perfectly no longer do so. Here is the key: those same scripts still run perfectly if I run them from XCode, Editra, or if I make the files executables and run them from Terminal. They only fail in TM.
I have run into two problems. First, this simple one-line script will cause two error windows to appear: text = raw_input("--> ")
The first error window says, "The application Python quit unexpectedly. The problem may have been caused by the tm_interactive_input.dylib plug-in." The second error window says, "The application tm_dialog2 quit unexpectedly." I can paste the error reports here if you want to see them.
The second script that causes problems is this (reduced down to its essentials): import pyglet
class Test(pyglet.window.Window): def __init__(self): pyglet.window.Window.__init__(self)
def on_draw(self): self.clear()
test = Test() pyglet.app.run()
I get this error message: OSError: dlopen(/System/Library/Frameworks/AGL.framework/AGL, 6): Symbol not found: _CGLClearDrawable Referenced from: /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo Expected in: flat namespace
function __getattr__ in __init__.py at line 307 __import__(import_name) module body in __init__.py at line 133 from pyglet.gl import gl_info module body in __init__.py at line 99 from pyglet.gl.lib import GLException module body in lib.py at line 141 from pyglet.gl.lib_agl import link_GL, link_GLU, link_AGL module body in lib_agl.py at line 51 framework='/System/Library/Frameworks/AGL.framework') function load_library in lib.py at line 90 return self.load_framework(kwargs['framework']) function load_framework in lib.py at line 226 lib = ctypes.cdll.LoadLibrary(realpath) function LoadLibrary in __init__.py at line 408 return self._dlltype(name) function __init__ in __init__.py at line 325 self._handle = _dlopen(self._name, mode)
That error message makes it seem like a pyglet problem, but again, I get no errors when running it outside of TM.
I am running Mac OS X 10.5.6 and the cutting edge version of TextMate (1498), and I completely reinstalled TM after experiencing these errors. I am using the stock Python that shipped with Leopard (2.5.1) and that's the version being used by the Python bundle. There were two older MacPorts versions of Python that were carried over to my Leopard installation, but I have uninstalled those. I tried setting the TM_PYTHON variable, but it made no difference.
A simple pure-Python script that doesn't use pyglet or raw_input will run fine: class Test(object): def __init__(self): print("Hello, World")
test = Test()
Odd. Ideas?
Jim