[redland-dev] Redland_python.unicode_to_bytes
Jasper OP DE COUL
jasper at infrae.com
Wed Jun 23 11:35:13 CEST 2010
Hi,
I'm using the the python redland bindings in ubuntu lucid
(http://packages.ubuntu.com/en/lucid/python-librdf)
and I'm having problems creating RDF.Node objects from unicode,
sometimes (not always) the following exception occurs:
>>> import RDF
>>> RDF.Node(u'foobarfoobarfoo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/dist-packages/RDF.py", line 270, in __init__
args['literal'] = Redland_python.unicode_to_bytes(arg)
SystemError: error return without exception set
Looking at Redland_python.unicode_to_bytes, I get
>>> Redland_python.unicode_to_bytes(u'foo')
'foo\x00\x00'
>>> Redland_python.unicode_to_bytes(u'foobar')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: error return without exception set
>>> Redland_python.unicode_to_bytes(u'foobar')
'foobar\x00\x00\x00\x00'
>>> Redland_python.unicode_to_bytes(u'foobarbaz')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: error return without exception set
>>> Redland_python.unicode_to_bytes(u'foobarbaz')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: error return without exception set
>>> Redland_python.unicode_to_bytes(u'foobarbaz')
'foobarbaz\x00foo\x00'
Is this a bug in Redland, or is it something Ubuntu specific?
I did a manual build using the redland-bindings-1.0.10.1 tarball
but had the same problem.
Regards,
Jasper
--
Jasper Op de Coul -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
More information about the redland-dev
mailing list