[Pythonmac-SIG] PyGame weirdness on OS X, leaks & exceptions
Ronald Oussoren
ronaldoussoren at mac.com
Sun Aug 8 11:55:25 CEST 2004
On 8-aug-04, at 11:47, Bob Ippolito wrote:
> On Aug 7, 2004, at 9:12 PM, Jerome wrote:
>
>> It seems there's a weird problem with something with python & pygame
>> on OS X, it works fine if you use pygame.init() in your code but if
>> you do them separate. BOOM!
>>
>> whole bunch of these:
>> 2004-08-07 21:08:15.153 Python[695] *** _NSAutoreleaseNoPool(): Object
>> 0x30ead0 of class NSCFArray autoreleased with no pool in place - just
>> leaking
>>
>> finishing up with this:
>> 2004-08-07 21:08:15.232 Python[695] *** Uncaught exception:
>> <NSInternalInconsistencyException> Error (1002) creating CGSWindow
>> Trace/BPT trap
>>
>> downloaded a couple pygames that did this, not sure if it's the pygame
>> 1.7 prerelase (1.6.2) or something weird in OS X, replacing their
>> inits with the single pygame.init() solved my problem for now, but
>> curious what's up
>
> I don't understand what you mean by "if you do them separate". If
> code uses pygame before calling pygame.init() then the code is broken,
> whether or not it happens to work on other platforms.
I no absolutely nothing about pygame but the reference docs say:
<quote>
pygame.init() -> passed, failed
Initialize all imported pygame modules. Including pygame modules that
are not part of the base modules (like font and image).
It does not raise exceptions, but instead silently counts which
modules have failed to init. The return argument contains a count of
the number of modules initialized, and the number of modules that
failed to initialize.
You can always initialize the modules you want by hand. The modules
that need it have an init() and quit() routine built in, which you can
call directly. They also have a get_init() routine which you can use to
doublecheck the initialization. Note that the manual init() routines
will raise an exception on error. Be aware that most platforms require
the display module to be initialized before others. This init() will
handle that for you, but if you initialize by hand, be aware of this
constraint.
As with the manual init() routines. It is safe to call this init() as
often as you like. If you have imported pygame modules since the.
</quote>
This seems to indicate you don't have to call pygame.init() but can
initialize the submodules you want to use by hand. The order of
initialization might cause problems.
Ronald
--
X|support bv http://www.xsupport.nl/
T: +31 610271479 F: +31 204416173
More information about the Pythonmac-SIG
mailing list