[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] pygame from OS X command line



I was excited to see on Bob Ippolito's website that he has updated OS X pygame so it will run without either pythonw or being in an app bundle. However, I found when running pygame (today's CVS) from fink python2.4, I got the following error:

---
[ben@assam ben] $ python2.4
Python 2.4.1 (#1, Aug 2 2005, 23:12:54)
[GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame.init()
>>> pygame.init()
(6, 0)
>>> screen = pygame.display.set_mode((468, 60))
2005-08-03 21:37:01.917 python2.4[26902] *** Uncaught exception: <NSInternalInconsistencyException> Error (1002) creating CGSWindow
Trace/BPT trap
---


I found this web page on the subject:
http://www.javworld.com/Extreme/GraphicsProg.html

Which enabled me to fix the problem like this:

---
diff -u -ruN -x'*~' pygame-cvs.orig/lib/__init__.py pygame-cvs/lib/ __init__.py
--- pygame-cvs.orig/lib/__init__.py 2005-08-03 20:01:31.000000000 -0700
+++ pygame-cvs/lib/__init__.py 2005-08-03 21:27:14.000000000 -0700
@@ -30,6 +30,8 @@
from objc import loadBundleFunctions
import AppKit
import Foundation
+ if not AppKit.NSApp():
+ AppKit.NSApplicationLoad()
except ImportError:
raise ImportError("PyObjC 1.2 or later is required to use pygame on Mac OS X")