parent
8c73137ffd
commit
3795974c6f
@ -375,16 +375,21 @@ class LineParser(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if use_gzip:
|
if use_gzip:
|
||||||
import io
|
if sys.version_info[0] == 2:
|
||||||
# Bug 6255. TextIOWrapper is required for python3 to present
|
ofile = gzip.open(filename, "rb")
|
||||||
# file contents as text, otherwise they are read
|
else:
|
||||||
# as binary. However due to a missing method (read1)
|
import io
|
||||||
# in early python3 versions this try block will fail
|
# Bug 6255. TextIOWrapper is required for python3 to
|
||||||
# It should work correctly from version 3.3
|
# present file contents as text, otherwise they
|
||||||
# Gramps will still import XML files using python
|
# are read as binary. However due to a missing
|
||||||
# versions < 3.3.0 but the file progress meter will
|
# method (read1) in early python3 versions this
|
||||||
# not work properly, going immediately to 100%.
|
# try block will fail.
|
||||||
ofile = io.TextIOWrapper(gzip.open(filename, "rb"))
|
# Gramps will still import XML files using python
|
||||||
|
# versions < 3.3.0 but the file progress meter
|
||||||
|
# will not work properly, going immediately to
|
||||||
|
# 100%.
|
||||||
|
# It should work correctly from version 3.3.
|
||||||
|
ofile = io.TextIOWrapper(gzip.open(filename, "rb"))
|
||||||
else:
|
else:
|
||||||
ofile = open(filename, "r")
|
ofile = open(filename, "r")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user