Commit cd3eb275 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[py3] Open files in binary mode in dataimport

parent 12980f28dd32
......@@ -18,6 +18,7 @@
from __future__ import print_function
import io
from itertools import count
from os.path import abspath, dirname, join
......@@ -110,7 +111,7 @@ LCSV_FILES = [(title, rtype, etype,
def lcsv_import(cnx, store, fname, scheme_uri, **kwargs):
"""Actually import LCSV data file."""
with open(fname) as stream:
with, 'rb') as stream:
extentities = skos.lcsv_extentities(stream, scheme_uri, ';', 'utf-8')
import_log = SimpleImportLog(fname)
skos.store_skos_extentities(cnx, store, extentities, import_log,
......@@ -124,7 +125,7 @@ def lcsv_check(cnx, store, fname, scheme_uri, separator=';', **kwargs):
def uri_generator(val):
return text_type(next(counter)) + val
with open(join(dirname(__file__), 'migration', 'data', fname)) as stream:
with, 'migration', 'data', fname), 'rb') as stream:
lcsv2rdf = lcsv.LCSV2RDF(stream, separator, 'utf-8',
# XXX drop once skos is released
uri_generator=uri_generator, uri_cls=text_type)
Supports Markdown
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