We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3e02eca + ca47f8b commit f1d3d09Copy full SHA for f1d3d09
heudiconv/utils.py
@@ -251,7 +251,17 @@ def treat_infofile(filename):
251
j = json.load(f)
252
253
j_slim = slim_down_info(j)
254
- j_pretty = json_dumps_pretty(j_slim, indent=2, sort_keys=True)
+ dumps_kw = dict(indent=2, sort_keys=True)
255
+ try:
256
+ j_pretty = json_dumps_pretty(j_slim, **dumps_kw)
257
+ except AssertionError as exc:
258
+ lgr.warning(
259
+ "Prettyfication of .json failed (%s). "
260
+ "Original .json will be kept as is. Please share (if you could) "
261
+ "that file (%s) with HeuDiConv developers"
262
+ % (str(exc), filename)
263
+ )
264
+ j_pretty = json.dumps(j_slim, **dumps_kw)
265
266
set_readonly(filename, False)
267
with open(filename, 'wt') as fp:
0 commit comments