[PySide] Is there a tutorial on good debugging techniques for PySide?

Stefan Champailler schampailler at skynet.be
Mon Feb 15 20:56:06 CET 2016

Alas poor Kevin,

You most probably felt into the memory leaks/garbage collections issue.

Since Qt is C++ and PySide is python, there's a mismatch in the memory models (C++ is managed memory, python is garbage collected). You have to think about that when developping. PySide is quite OK to work with, but you have to have this aspect in mind...

For my part, I've tried detecting memory leaks and GC conflicts with a debug/valgrind-ready python/qt/pyside but it didn't help much. The easiest is to double check your code for memory problematic code... That's the bad side of PySide (and PyQt as well I think)


On Sun, 14 Feb 2016 16:54:22 -0500
Kevin Cole <dc.loco at gmail.com> wrote:

> Hi,
> I have two applications created using PySide. Both have many of the
> same widgets (menus and side bars) with a single QGroupBox that is
> different between the two. So, after refactoring, there is now a lot
> of shared code between the two that has been extracted into its own
> module.  Sadly, I'm in a rare situation of not being able to share the
> code at this point.
> Now, one program still runs fine.  The other does not. It just hangs,
> never displaying the UI, and ignoring keyboard interrupts in the
> console... unless I insert pdb.set_trace() and try to trace the error
> down.  Calling set_trace() and typing "c" at the pdb prompt causes the
> second program to work just fine.  Replacing the set_trace() with
> either sleep() or input() brought back the hanging behavior.
> In summary:
> ui = UI(initValues)
> ui.show()
> fails, but:
> ui.UI(initValues)
> pdb.set_trace()      # or ipdb.set_trace()
> ui.show()
> works (after typing "c" at the interactive pdb prompt).
> Any suggestions?  Thanks!
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

Timeo Danaos et dona ferentes
Twitter : @Arakowa1

More information about the PySide mailing list