[PyKDE] PyQt + multiple Interpreters

Phil Thompson phil at riverbankcomputing.co.uk
Fri Sep 17 18:49:36 BST 2004


On Friday 17 September 2004 10:17 am, Christoph Wiedemann wrote:
> Hi Phil,
>
> > SIP v3.x is deprecated. Try v4 see what happens.
>
> i've tried (sip 4.0.1) - and there are several issues arising from the fact
> that i use embedded python interpreters.
>
> 1. i've used to link my application against libqtcmodule.so, which has
> disappeared (renamed to qt.so). I do this in order to use
> sipForceConvertTo_QWidget in my embedding application.
>
> What is the recommended way to get a QWidget pointer from a PyObject * in
> an embedding application with sip 4.x ?

Call sipForceConvertTo_QWidget(). It's covered in the documentation. You don't 
need to link against anything.

> 2. i couldn't use the new EnsureGIL methods (got a deadlock somewhere), so
> i've used the -g switch while configuring PyQt.

There are bugs in Python's thread handling that are fixed in the current 2.4 
alpha version and will be fixed in the next 2.3.x release. This may not be 
your problem, but it might be worth trying.

> My main question still remains: Is there a way to control the ThreadState
> PyQt acquires when calling virtual python functions? The situation is as
> follows: i have two or more PyInterpreters in my application. I want to
> provide a shell widget for each interpreter, which is most simply done with
> PyCute. But when i type print "Hello", Hello pops up in incorrect places
> (the wrong shell widget / or even in the application stdout).

I don't really understand what you are trying to do. You either have the right 
thread state or the wrong one - it's not something you would want to control.

> Any ideas?

Note that I seem to remember comments on the Python mailing lists to the 
effect that multiple interpreters are flakey.

Phil




More information about the PyQt mailing list