[PyQt] Compiler Error using SIP: error C3861:
'PyUnicode_FromFormat': identifier not found
Phil Thompson
phil at riverbankcomputing.com
Mon Oct 26 08:05:33 GMT 2009
On Sun, 25 Oct 2009 14:45:44 -0700, Jamie Riotto <jamie.riotto at gmail.com>
wrote:
> Hi,
> I'm trying to learn to use SIP, and I've started out with a simple
> Vector class. The sip file looks like this:
>
>
===========================================================================
> %Module Vec3 0
>
> class Vec3 {
>
> %TypeHeaderCode
> #include "Vec3.h"
> %End
>
> public:
>
> float x;
> float y;
> float z;
>
> Vec3();
> Vec3(float xpos,float ypos,float zpos);
> float getX();
> float getY();
> float getZ();
> SIP_PYOBJECT __repr__() const;
> %MethodCode
> sipRes = PyUnicode_FromFormat("Vec3(%f, %f, %f)", sipCpp->getX(),
> sipCpp->getY(), sipCpp->getZ());
> %End
> };
>
>
==============================================================================
>
> The __repr__ section is my frist attempt at implementing python
> functions (operators next). I've used QPoint.h and QPoint.sip
> as my starting point. The c++ code compiles ok , but when I try to
> compile SIP with the following makefile,
>
> I get the following error:
>
> sipvec3Vec3.cpp
> vec3.sip(26): error C3861: 'PyUnicode_FromFormat': identifier not found
>
> Any suggestions? Thanks - jamie
If you look up PyUnicode_FromFormat() in the Python docs you will see that
there is no such function.
There is PyUnicode_Format() but make sure you call it properly.
Phil
More information about the PyQt
mailing list