[PyQt] Running Python scripts from a SIP-wrapped library

Jens Thoms Toerring jt at toerring.de
Sun Jul 31 13:42:44 BST 2011


Hi Matt;

On Sat, Jul 30, 2011 at 04:49:07PM -0700, Matt Newell wrote:
> My quick guess is that you should not be calling Py_NewInterpreter, but 
> instead wrap your calls into python code with
> 
> SIP_BLOCK_THREADS
> // Call python functions
> SIP_UNBLOCK_THREADS
> 
> These are just macros for calling PyGILState_Ensure/PyGILState_Release, so you 
> can call them directly if you aren't doing this inside a sip module.
> 
> #define SIP_BLOCK_THREADS   {PyGILState_STATE sipGIL = PyGILState_Ensure();
> #define SIP_UNBLOCK_THREADS PyGILState_Release(sipGIL);}

Thanks really a lot, that did the trick! While I don't feel
that I understand the reasons yet I'm happy enough that it
seems to work now;-)
                      Thanks again and best regards, Jens
-- 
  \   Jens Thoms Toerring  ________      jt at toerring.de
   \_______________________________      http://toerring.de


More information about the PyQt mailing list