[PyKDE] QString to Python string conversion trouble

Andreas Gerstlauer gerstl at ics.uci.edu
Tue Oct 23 00:40:18 BST 2001


Hi!

I am having problems with QString to Python string conversion
ever since the latest update of PyQt (3.0pre4; together with
Python 2.0 and QT 3.0.0). See the following trace:

---- snipp ----

% python
Python 2.0 (#10, Feb 13 2001, 13:25:47) 
[GCC 2.95.2 19991024 (release)] on sunos5
Type "copyright", "credits" or "license" for more information.
>>> import qt
>>> l = "Test\nTest"
>>> print l
Test
Test
>>> s = qt.QString(l)
>>> print str(s)
Test\012Test
>>>

---- snipp ----

This is not the behavior we used to have before and it is not
the behavior I would expect (back-and-forth conversion between
QStrings and Python strings should be transparent). Is this
new behavior intended? If so, how do I get the "real" string
out of a QString object now (apparently _not_ the str() function
any more as that gives me some sort of encoded string)?

Andreas






More information about the PyQt mailing list