Skip to content

Commit

Permalink
Merge pull request #1049 from alperkent/master
Browse files Browse the repository at this point in the history
Handling FileNotFoundError in BIDSLayout Initialization when is_derivative=True and validate=False, also resolves #1050
  • Loading branch information
effigies committed May 10, 2024
2 parents 09448ad + 2320324 commit 87eecc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bids/layout/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ def _index_metadata(self):
# ensure we are returning objects
filters['return_type'] = 'object'

if filters.get(ext_key):
filters[ext_key] = listify(filters[ext_key])
if filters.get('extension'):
filters['extension'] = listify(filters['extension'])
# ensure json files are being indexed
if '.json' not in filters[ext_key]:
filters[ext_key].append('.json')
if '.json' not in filters['extension']:
filters['extension'].append('.json')

# Process JSON files first if we're indexing metadata
all_files = self._layout.get(absolute_paths=True, **filters)
Expand Down
2 changes: 1 addition & 1 deletion bids/layout/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self, root=None, validate=True, absolute_paths=True,
]):
try:
self.source_pipeline = validate_derivative_path(root)
except BIDSValidationError as err:
except (BIDSValidationError, FileNotFoundError) as err:
if validate:
raise err
self.source_pipeline = None
Expand Down

0 comments on commit 87eecc5

Please sign in to comment.