This is a collaborative space. In order to contribute, send an email to maximilien.chaumon@icm-institute.org
On any page, type the letter L on your keyboard to add a "Label" to the page, which will make search easier.

Handling optional file

In the neuro/meg/fif datatype, some files are optional, i.e. the App user doesn’t have to provide them to run the App (see Error when an optional file is not available in a dataset). So, the App developer must check if the file exists or not and to do so, the command os.path.exists() is used.

Locally, in case where the optional file was not provided, it was written as follows in the config.json.example:

{ "fif": "/network/lustre/iss01/home/aurore.bussalb/Repositories/app-maxfilter/data/rest1-raw.fif", "calibration": null, }

But, when the command os.path.exists() was applied, an error occurred, because it cannot handle a None value.

So, in the Python code, we must test if the variable is None or not before testing if the path exists:

calibration_file = config.pop('calibration') if calibration_file is not None: if os.path.exists(calibration_file) is False: calibration_file = None