You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> g = rdflib.Graph()
>>> g.add(("#foo","#bar","#foobar"))
>>> g.serialize()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rdflib/graph.py", line 802, in serialize
serializer.serialize(stream, base=base, encoding=encoding, **args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rdflib/plugins/serializers/rdfxml.py", line 62, in serialize
bindings = list(self.__bindings())
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rdflib/plugins/serializers/rdfxml.py", line 31, in __bindings
prefix, namespace, name = nm.compute_qname(predicate)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rdflib/namespace.py", line 264, in compute_qname
namespace, name = split_uri(uri)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rdflib/namespace.py", line 395, in split_uri
if not category(c) in NAME_CATEGORIES:
TypeError: must be unicode, not str
The error is only caught when serializing the graph, not before. It seems to me that the .add() method should have caught this already.
The text was updated successfully, but these errors were encountered:
I heard that performance might be an issue, which is why I used assert statements. Those will get removed if you're asking Python to do performance enhancements.
On the one hand this means that it's not a fool-proof fix, but it does make it a lot more userfriendly for 90% of the users. And the other 10% should run their code in normal mode first anyway ;).
Consider the following:
The error is only caught when serializing the graph, not before. It seems to me that the .add() method should have caught this already.
The text was updated successfully, but these errors were encountered: