diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 89a89544f..ff07cb8b6 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -592,19 +592,29 @@ def inspect_nwb_file(payload): def inspect_nwb_folder(payload): from nwbinspector import inspect_all, load_config from nwbinspector.nwbinspector import InspectorOutputJSONEncoder - - messages = list( - inspect_all( - n_jobs=-2, # uses number of CPU - 1 - ignore=[ - "check_description", - "check_data_orientation", - ], # TODO: remove when metadata control is exposed - config=load_config(filepath_or_keyword="dandi"), - **payload, - ) + from pickle import PicklingError + + kwargs = dict( + n_jobs=-2, # uses number of CPU - 1 + ignore=[ + "check_description", + "check_data_orientation", + ], # TODO: remove when metadata control is exposed + config=load_config(filepath_or_keyword="dandi"), + **payload, ) + try: + messages = list(inspect_all(**kwargs)) + except PicklingError as e: + if "attribute lookup auto_parse_some_output on nwbinspector.register_checks failed" in str(e): + del kwargs["n_jobs"] + messages = list(inspect_all(**kwargs)) + else: + raise e + except Exception as e: + raise e + return json.loads(json.dumps(obj=messages, cls=InspectorOutputJSONEncoder))