with open for sidecar
@@ -388,7 +388,8 @@ class BIDSLayout(object):
instance_args = self._sanitize_instance_args()
if not reset_database:
- saved_args = json.load(open(database_sidecar))
+ with open(database_sidecar) as fobj:
+ saved_args = json.load(fobj)
for k, v in saved_args.items():
if instance_args[k] != v:
raise ValueError(
