Commit 5b167023 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[py3] Decode "sample" before sniffing CSV for delimiter

On python3, csv module uses unicode strings. Since we use bytes strings
on our side, we need to decode when calling csv module ourselves.
parent 603102864443
......@@ -43,7 +43,7 @@ class LCSV2RDF(object):
uri_generator=None, uri_cls=text_type, default_lang=None):
""" check stream validity and init attribute"""
if delimiter is None:
sample = stream.read(1024)
sample = stream.read(1024).decode('utf-8')
stream.seek(0)
delimiter = csv.Sniffer().sniff(sample).delimiter
self.source_file = ucsvreader(stream, encoding=encoding, delimiter=delimiter)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment