def _fs_home_problem(fs_home):
    if fs_home is None:
        return "FREESURFER_HOME is not set."
    elif not os.path.exists(fs_home):
        return "FREESURFER_HOME (%s) does not exist." % fs_home
    else:
        test_dir = os.path.join(fs_home, 'subjects', 'fsaverage')
        if not os.path.exists(test_dir):
            return ("FREESURFER_HOME (%s) does not contain the fsaverage "
                    "subject." % fs_home)
Check FREESURFER_HOME path
dataset/ETHPy150Open mne-tools/mne-python/mne/gui/_file_traits.py/_fs_home_problem