[PyQt] SIP example code issue with python 3.3

Christoff Kok christoff.kok at ex-mente.co.za
Wed Apr 30 16:09:31 BST 2014


I apologize if I am using the mailing system wrong, please correct me if I
do. 1st time user of such a channel.

I trying to learn SIP and came across an issue when trying to implement the
example code given in the documentation.
%Module word
#include "word.h"
#include <string.h>

    Word(const char *w);
    char *reverse() const;

After successfully running the deploying it in python, I tried to create a
Word variable: e.g.

>>> from word import Word
>>> w = Word("cheese snacks")
*# python throws an error here:*
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Word(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'str'
*# help(Word) informs me that Word is expecting a sip.wrapper object, not a
string as I expected*
>>> help(Word)
Help on class Word in module word:

class Word(sip.wrapper)

This was not expected, I expected it to just work as the example given. Any
help? I am working on Windows 7 in python 3.3.4
I tried including MappedType char * but received the error: "Invalid type
for %MappedType"

Kind Regards,

Christoff Kok
Software Engineer
Ex Mente

christoff.kok at ex-mente.co.za
PO Box 10214
South Africa
tel: +27 12 743 6993
tel: +27 12 654 8198
fax: +27 85 150 1341
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140430/c9be30e7/attachment.html>

More information about the PyQt mailing list