diff --git a/glymur/_uuid_io.py b/glymur/_uuid_io.py index daa1994..f64baa6 100644 --- a/glymur/_uuid_io.py +++ b/glymur/_uuid_io.py @@ -37,7 +37,9 @@ def tiff_header(read_buffer): # big endian endian = '>' else: - msg = "Bad byte order indication: {0}".format(read_buffer[6:8]) + msg = "The byte order indication in the TIFF header ({0}) is invalid. " + msg += "It should be either {1} or {2}." + msg = msg.format(read_buffer[6:8], bytes([73, 73]), bytes([77, 77])) raise IOError(msg) _, offset = struct.unpack(endian + 'HI', read_buffer[8:14]) diff --git a/glymur/test/test_jp2box_uuid.py b/glymur/test/test_jp2box_uuid.py index b6e9762..f24aafe 100644 --- a/glymur/test/test_jp2box_uuid.py +++ b/glymur/test/test_jp2box_uuid.py @@ -167,6 +167,10 @@ class TestUUIDExif(unittest.TestCase): warnings.simplefilter('always') j = glymur.Jp2k(tfile.name) self.assertTrue(issubclass(w[0].category, UserWarning)) + msg = 'The byte order indication in the TIFF header ' + msg += "(b'JI') is invalid. " + msg += "It should be either b'II' or b'MM'." + self.assertTrue(msg in str(w[0].message)) self.assertEqual(j.box[-1].box_id, 'uuid')