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

Re: [pygame] pygame from OS X command line




On Aug 4, 2005, at 6:16 AM, Ben Willmore wrote:

Hi again Bob,

Yes, I'm using current CVS pygame.

From some more investigation, it seems there are two separate problems:

1) Error (1002) creating CGSWindow
This is unrelated to timing -- it happens (with vanilla CVS pygame) with the following script:
python2.4 -i -c "import pygame; pygame.init();screen = pygame.display.set_mode((468, 60))"


However, if I add 'import pygame.macosx;pygame.macosx.init()' before the set_mode, it works. Just putting macosx.init() after the import in packager_imports() does not work; nor does just importing macosx earlier, without running macosx.init() explicitly.

Investigation shows that, with vanilla CVS pygame, neither macosx.init() nor pygame.packager_imports() is being called before the crash. I can't work out how macosx.init() or pygame.packager_imports() are supposed to get called normally - my python is weak.

Currently, I'm 'fixing' this with:
pygame.__init__.py:
_check_darwin(): Add
import pygame.macosx
macosx.init()

Well the issue here is that applications that use PyObjC to show a custom UI don't want macosx.init() to be called before NSApplication.run() or equivalent has already happened, because pygame will try and do its own thing at that point and set up the application improperly.


It should work just fine without any of this. The only factor that I can point to is fink. If you stop using fink, your problems will probably disappear. The normal Python 2.4.1 distribution has no problems at all with pygame CVS on any of the machines I've tried it on.

packager_imports(): Remove:
import pygame.macosx

Will this cause problems?

packager_imports() is never executed, and exists purely to generate bytecode that py2exe and py2app will want to see. Changing it is doing them a disservice, and not helping you any. I'm not sure why you felt the need to touch this.


-bob