UserWarning: NTSerializer does not use custom encoding when serializing to N-Triples #1617
-
When I serialize a graph to N-Triples using rdflib 6.0.0, I get the following warning:
I did not get this warning in rdflib 5.0.0, and I am not specifying a custom encoding. In rdflib 5.0.0: Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
RDFLib Version: 5.0.0
>>> g = rdflib.Graph()
>>> g.parse('example3.nt', format='nt')
<Graph identifier=Ned04151a53fa4b9da44a1a3c1880071a (<class 'rdflib.graph.Graph'>)>
>>> out = g.serialize(format='nt')
>>> In rdflib 6.0.0: Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
RDFLib Version: 6.0.0
>>> g = rdflib.Graph()
>>> g.parse('example3.nt', format='nt')
<Graph identifier=N48d61e6c8ba447a085e7a693015d6a4e (<class 'rdflib.graph.Graph'>)>
>>> out = g.serialize(format='nt')
.../plugins/serializers/nt.py:28: UserWarning: NTSerializer does not use custom encoding.
warnings.warn("NTSerializer does not use custom encoding.")
>>> Source diving tells me that I did not expect a warning about a custom encoding because I did not specify an encoding, custom or otherwise. This code closely follows the RDF/XML example in the Saving RDF documentation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Workaround: use Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
RDFLib Version: 6.0.0
>>> g = rdflib.Graph()
>>> g.parse('example3.nt', format='nt')
<Graph identifier=N28292d3babca46daa94ad47248958fa6 (<class 'rdflib.graph.Graph'>)>
>>> out = g.serialize(format='nt11')
>>> Why isn't N-Triples 1.1 the default? It dates to February, 2014. |
Beta Was this translation helpful? Give feedback.
Workaround: use
'nt11'
serializer:Why isn't N-Triples 1.1 the default? It dates to February, 2014.