ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pygame-users
pygame-users
Re: [pygame] pygame from OS X command line
by Bob Ippolito other posts by this author
Aug 4 2005 9:32AM messages near this date
Re: [pygame] pygame from OS X command line | 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
Thread:
Ben Willmore
Bob Ippolito
Bob Ippolito
Ben Willmore
Ben Willmore
Bob Ippolito
Ben Willmore
Bob Ippolito
Ben Willmore
Bob Ippolito
Ben Willmore
Bob Ippolito
Ben Willmore

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved