gjhiggins/rdfextras — Issue #3: sparql query result serializer possibly broken in Python 2.4
Author: gjhiggins
Created: 2011-10-19 02:58:06+00:00
State: open

Originally filed by rubinsztajn on 2010-06-28T17:34:41

Using rdflib 3.0.0 on Python 2.4

If I query a graph like so:

g = ConjunctiveGraph('rdfxmlfile.rdf')
r = g.query('PREFIX foaf: SELECT * WHERE { ?s foaf:name ?o }')

len(g) #496

print r.serialize()

I get the following error:

Traceback (most recent call last):
File "sparql.py", line 13, in ?
print r.serialize()
File "/home/rubinsta/lib/python/rdfextras/sparql/query.py", line 1529, in serialize
writer.write_header(allvarsL)
File "/home/rubinsta/lib/python/rdfextras/sparql/query.py", line 1280, in write_header
AttributesNSImpl(attr_vals, attr_qnames))
File "/usr/lib/python2.4/xml/sax/saxutils.py", line 139, in startElementNS
name = self._current_context[name[0]] + ":" + name[1]
KeyError

This works fine on Python 2.6

I realize that a fix to support Python 2.4 is unlikely but I would love confirmation that this is a bug that crops up only in pre 2.6 versions of Python.

Thanks!