RuntimeError exceptions (was Re: [PyKDE] Signals and Slots in PyQt4)

Matthew Scott mscott at
Mon Dec 19 01:04:00 GMT 2005

On 12/18/05, Phil Thompson <phil at> wrote:
> On Sunday 18 December 2005 6:33 pm, Baz Walter wrote:
> > Hello
> >
> > When disconnecting a signal from a python slot, if the connection has not
> > already been made, it produces the error: 'RuntimeError: Slot hasn't been
> > connected'. However, QObject.disconnect gives a boolean result on
> > success/failure. So is this error really necessary? (With unconnected qt
> > slots, disconnect just returns false).
> I'll take a look at that.

On a more general note about RuntimeError exceptions, would it be
prudent to subclass RuntimeError for any exceptions of this type that
PyQt raises?

For example, I mentally cringed when I implemented this:

It would be much more comfortable to catch a specific subclass of
RuntimeError rather than RuntimeError itself. :)

Matthew R. Scott

More information about the PyQt mailing list