Skip to content

Commit 3993b97

Browse files
committed
ENH: Use appropriate message when reporting TCK file attribute error
Use appropriate message when reporting `file` attribute error in TCK: the previous message was mistakenly reporting the non-existence of the `file` attribute, which indeed has to exist to be able to do the `hdr['file']` without getting a `KeyError`. This patch set uses the message that was not being used when the check was not being successful.
1 parent 30a5f3f commit 3993b97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nibabel/streamlines/tck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def _read_header(cls, fileobj):
385385
'TCK only supports single-file - in other words the filename part must be '
386386
f"specified as '.' but '{hdr['file'].split()[0]}' was specified."
387387
)
388-
raise HeaderError("Missing 'file' attribute in TCK header.")
388+
raise HeaderError(msg)
389389

390390
# Set endianness and _dtype attributes in the header.
391391
hdr[Field.ENDIANNESS] = '>' if hdr['datatype'].endswith('BE') else '<'

0 commit comments

Comments
 (0)