Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
seda
Commits
33ad61a9f699
Commit
cd3eb275
authored
Oct 02, 2019
by
Denis Laxalde
Browse files
[py3] Open files in binary mode in dataimport
parent
12980f28dd32
Changes
1
Hide whitespace changes
Inline
Side-by-side
cubicweb_seda/dataimport.py
View file @
33ad61a9
...
...
@@ -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
io
.
open
(
fname
,
'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
io
.
open
(
join
(
dirname
(
__file__
),
'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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment