using io.open, instead of open (python 2.6/2.7)
This commit is contained in:
parent
8d4db0282f
commit
50330e38d1
1 changed files with 3 additions and 7 deletions
|
@ -6,7 +6,7 @@ import os
|
||||||
import glob
|
import glob
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import sys
|
import io
|
||||||
|
|
||||||
import bumblebee.error
|
import bumblebee.error
|
||||||
|
|
||||||
|
@ -110,11 +110,7 @@ class Theme(object):
|
||||||
|
|
||||||
if os.path.isfile(themefile):
|
if os.path.isfile(themefile):
|
||||||
try:
|
try:
|
||||||
if(sys.version_info > (3,0)):
|
with io.open(themefile,encoding="utf-8") as data:
|
||||||
with open(themefile,encoding="utf-8") as data:
|
|
||||||
return json.load(data)
|
|
||||||
else:
|
|
||||||
with open(themefile) as data:
|
|
||||||
return json.load(data)
|
return json.load(data)
|
||||||
except ValueError as exception:
|
except ValueError as exception:
|
||||||
raise bumblebee.error.ThemeLoadError("JSON error: {}".format(exception))
|
raise bumblebee.error.ThemeLoadError("JSON error: {}".format(exception))
|
||||||
|
|
Loading…
Reference in a new issue