[PyQt] SIP and QString

Luca Beltrame einar at heavensinferno.net
Sun Nov 18 15:36:14 GMT 2012


Hello,

while testing PyKDE4's modules with Python3, I noticed that the i18n() calls, 
which accept const char*, are not properly handled in Python 3 (both with API 
version 1 and 2):

In [2]: from PyKDE4.kdecore import i18n

In [3]: i18n("Test")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-00970cb5d435> in <module>()
----> 1 i18n("Test")

TypeError: i18n(): argument 1 has unexpected type 'str'

It does work if I pass bytes, but that's not correct, as we're dealing with 
strings here.

PyQt documentation states that char* or const char* would be acceptable with 
strings (Python 3 strings). 

As the original SIP file had custom code inside, I'm attaching it here. I 
looked at it briefly, but I couldn't find why it didn't work.

Can anyone shed a light on this issue?


-- 
Luca Beltrame - KDE Forums team
KDE Science supporter
GPG key ID: 6E1A4E79
-------------- next part --------------
A non-text attachment was scrubbed...
Name: klocalizedstring.sip
Type: text/x-csrc
Size: 6250 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121118/67a045b6/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20121118/67a045b6/attachment.pgp>


More information about the PyQt mailing list