explicity encoding only for Python 3

This commit is contained in:
thunderstruck47 2017-05-13 17:16:34 +03:00
parent bfa06cead1
commit 8d4db0282f

View file

@ -6,6 +6,7 @@ import os
import glob import glob
import copy import copy
import json import json
import sys
import bumblebee.error import bumblebee.error
@ -109,8 +110,12 @@ class Theme(object):
if os.path.isfile(themefile): if os.path.isfile(themefile):
try: try:
with open(themefile, encoding="utf-8") as data: if(sys.version_info > (3,0)):
return json.load(data) with open(themefile,encoding="utf-8") as data:
return json.load(data)
else:
with open(themefile) as 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))
else: else: