[PyKDE] Printing empty QStrings

Boudewijn Rempt bsarempt at rempt.xs4all.nl
Mon Oct 30 21:33:08 GMT 2000

Around version 0.10.1 QString started to return None when empty, instead
of segfaulting. However, with the current version and Python 2.0, there
is another problem: if you want to print an emtpy QString, you get the

Python 2.0 (#1, Oct 28 2000, 11:41:22)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import qt
>>> a = qt.QChar()
>>> print a
<qt.QChar instance at 0x81d71f4>
>>> a=qt.QString()
>>> print a
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.0/site-packages/qt.py", line 898, in
    return str(self.sipThis)
TypeError: __str__ returned non-string (type None)

I'm not sure what's right - returning None or repr(None) - but this
used to work.

More information about the PyQt mailing list