diff --git a/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb1_session_api.py b/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb1_session_api.py index e1b9a7d95..4e94fbed4 100644 --- a/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb1_session_api.py +++ b/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb1_session_api.py @@ -62,8 +62,10 @@ def __init__(self, path, *args, **kwargs): try: # check file is a valid NWB 1 file version_str = self._h5_root['nwb_version'][()] - if not (version_str.startswith(b'NWB-1.') or - version_str.startswith(b'1.')): + if isinstance(version_str, bytes): + version_str = version_str.decode('utf-8') + if not (version_str.startswith('NWB-1.') or + version_str.startswith('1.')): raise Exception( '{} is not a valid NWB 1 file path'.format(self._path)) except Exception: