[Pythonmac-SIG] lots of Python-Cocoa errors in XCode console window...

has hengist.podd at virgin.net
Mon Nov 3 19:10:34 CET 2008


On 2 Nov 2008, at 23:02, Bill Janssen wrote:

>> Are you using background threads? PyObjC automatically creates an
>> autorelease pool for the main thread only; you need to provide
>> autorelease pools for other threads yourself.
>
> Yes, I am using background threads.  I have some functions triggered  
> by
> actions which make calls on remote services, and so may take  
> arbitrarily
> long to execute; I fork worker threads to do that fetch.  I'm using
> Python's threading.Thread; should my "target" function look like this?
>
>   def thread_target(*args):
>      pool = NSAutoreleasePool.alloc().init()
>      try:
>          ...
>      finally:
>          del pool

I believe that's what the PyObjC documentation recommends.

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



More information about the Pythonmac-SIG mailing list