[PyQt] PyQt5 and temporary python interpreter in a C++ program
Phil Thompson
phil at riverbankcomputing.com
Mon May 18 18:31:30 BST 2015
On 18/05/2015 6:19 pm, Pierre Barbier de Reuille wrote:
> Hi,
>
> I have a C++ application that can be scripted with Python. As the
> scripting
> is very localized in time, I had originally chosen to initialize the
> interpreter before each script, and finalize it after each script.
>
> This worked very well until I tried to use PyQt5 in my scripts! If I do
> that, it works the first time, but on the next initialization, all the
> modules are close to empty. In particular, they don't have any classes!
>
> As a temporary solution, I initialize the interpreter once at the start
> of
> my application, and re-use it over and over. But this is not ideal! In
> particular, that would allow for resources leaks, which I would like to
> avoid. Is this a known issue with PyQt? Is there something I can do to
> make
> this work?
Neither sip or PyQt do a very good job about tidying up on finalisation.
There is no one specific thing - just lots of little ones. Fixing it has
just been low priority.
Phil
More information about the PyQt
mailing list