[PyQt] How to avoid "QTextCodec::~QTextCodec: Called by application"?

Phil Thompson phil at riverbankcomputing.co.uk
Tue Dec 11 14:32:58 GMT 2007


On Tuesday 11 December 2007, DDGG wrote:
> I have a codec class:
>
> # gb18030.py
> from PyQt4 import QtCore
>
> class QGb18030Codec(QtCore.QTextCodec):
>    def __init__(self):
>        QtCore.QTextCodec.__init__(self)
>
>    def name(self):
>        return "GB18030"
>
>    def aliases(self):
>        return []
>
>    def mibEnum(self):
>        return 114
>
>    def convertToUnicode(self, chars, len):
>        ...
>
>    def convertFromUnicode(self, uc, len, state):
>        ...
>
> gb18030 = QGb18030Codec()
>
> # end
>
> After i have run it, i got a notice message in my console window:
> QTextCodec::~QTextCodec: Called by application
> How to avoid this message?

It's a PyQt bug. Something like...

import sip

codec = QGb18030Codec()
sip.transferto(codec, None)

...should work around it.

Phil


More information about the PyQt mailing list