[redland-dev] unicode issue on os x with python bindings

Dave Beckett dave.beckett at bristol.ac.uk
Thu May 12 10:01:07 BST 2005


On Thu, 12 May 2005, Suzan Foster wrote:
> Line 34. 1591 in RDF.py.
...
> You need the Python/XML libraries (http://pyxml.sourceforge.net/).

Thanks

<snip/>

So I tried this against redland 1.0.0 using the bindings 1.0.0.2 with
python and see the same problem. (On OSX 10.3.x)

However, it works fine with redland cvs and bindings cvs: ...

Walking http://www.ipodder.org/discuss/reader$4.opml
Found channel http://www.ipodder.org/aboutTheDirectory
librdf error URI http://www.ipodder.org/aboutTheDirectory:1 - 
SystemLiteral " or ' expected
librdf error URI http://www.ipodder.org/aboutTheDirectory:1 - SYSTEM or 
PUBLIC, the URI is missing
http://www.ipodder.org/aboutTheDirectory threw an exception. Space 
required after the Public Identifier

... in a sense.  At least it didn't crash on the bad XML.

So the question is can I get you a fix?

Looks to me that the change is in the generated SWIG interface.
Seems that swig 1.3.24 does a better/different thing in making the
bindings.  In the generated code in Redland_wrap.c for the librdf_new_uri
call inside the function

static PyObject *_wrap_librdf_new_uri(PyObject *self, PyObject *args) {
...
}

it uses:
    if(!PyArg_ParseTuple(args,(char *)"OO:librdf_new_uri",&obj0,&obj1)) 
expecting an Object arg for the URI (obj1)

but the shipped tarball with 1.3.21 has:
    if(!PyArg_ParseTuple(args,(char *)"Os:librdf_new_uri",&obj0,&arg2)) 
expecting a string arg for the URI (arg2)

So... try installing swig 1.3.24, go to ... bindings-1.0.0.2 dir

cd python
rm Redland_wrap*
make clean
make

which hopefully will re-run swig and make new generated C file, python API 
that won't crash.

Dave



More information about the redland-dev mailing list