[PyKDE] Runtime Error

Toby Dickenson tdickenson at geminidataloggers.com
Thu Jul 1 13:43:01 BST 2004


On Thursday 01 July 2004 12:07, you wrote:
> On Thursday 01 July 2004 11:43 am, Toby Dickenson wrote:
> > In sip 3.8 and PyQt 3.8.1....
> >
> > >>> qt.QStyleFactory.create('style that does not exist')
> >
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > RuntimeError: Attempt to create a Python instance for a NULL pointer
> >
> > Bug, or just a curious interface?
>
> Or an accurate error message. 

Could be that too, yes.

> Any suggestion as to what would seem more 
> natural?

RuntimeError is normally used to communicate a program logic abnormality. It 
conveys similar information to an ASSERT, although in a different manner. 

This Qt method returning NULL is perfectly normal (although the qt 
documentation doesnt state that :-(. The nature of the error is different to 
"Underlying C/C++ object has been deleted", so RuntimeError felt suprising.

I anticipated either a return value of None, or an exception derived from 
ValueError (indicating that the value of the style name is wrong).


-- 
Toby Dickenson




More information about the PyQt mailing list