Skip to content

Commit

Permalink
Merge pull request #2284 from AllenInstitute/fix_py36_compare_bytes
Browse files Browse the repository at this point in the history
Fixes issue in which py36 returns string and cannot compare to bytes
  • Loading branch information
aamster authored Jan 3, 2022
2 parents 0a924dc + cbb2396 commit 656e01a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 656e01a

Please sign in to comment.