[PyQt] How to create a codec class?

dboddie at trolltech.com dboddie at trolltech.com
Thu Dec 6 20:53:05 GMT 2007


On Thu Dec 6 19:19:34 GMT 2007, David Boddie wrote:

> If you miss out this step for QObject subclasses, you'll get an error like
> the one you reported:
> 
> > Traceback (most recent call last):
> >   File "cncodec.py", line 26, in <module>
> >     QtCore.QTextCodec.setCodecForCStrings(gb18030)
> > RuntimeError: underlying C/C++ object has been deleted
> 
> This should probably go in an FAQ somewhere.

In fact, I think it's the same for any wrapped C++ class. Reimplement
the __init__() method and you have to call the base class's __init__()
method or the instance won't be set up correctly.

David



More information about the PyQt mailing list