forces utf-8 encoding; fixes
@@ -5,7 +5,6 @@ import json
from os.path import dirname
from os.path import abspath
from os.path import join as pathjoin
-from os.path import basename
from grabbit import Layout
@@ -48,12 +47,15 @@ class BIDSLayout(Layout):
def get_metadata(self, path, **kwargs):
potentialJSONs = self._get_nearest_helper(path, '.json', **kwargs)
- if not isinstance(potentialJSONs, list): return potentialJSONs
+
+ if not isinstance(potentialJSONs, list):
+ return potentialJSONs
merged_param_dict = {}
for json_file_path in reversed(potentialJSONs):
if os.path.exists(json_file_path):
- param_dict = json.load(open(json_file_path, "r"))
+ param_dict = json.load(open(json_file_path, "r",
+ encoding='utf-8'))
merged_param_dict.update(param_dict)
return merged_param_dict
