From cba4eee4cd84ffd08ef0005106cf5d4bf9cb07db Mon Sep 17 00:00:00 2001 From: swoertz Date: Tue, 27 May 2014 19:44:46 +0200 Subject: [PATCH] Update bmp.py A bitmap file has to be opened in "rb" mode in python 3, but then b'BM' != 'BM'. Hence the parse function raises an error. This fix should do the trick. Tested with python2.7.6 and python3.4.0 --- construct/formats/graphics/bmp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/construct/formats/graphics/bmp.py b/construct/formats/graphics/bmp.py index 687421de0..aad464c25 100644 --- a/construct/formats/graphics/bmp.py +++ b/construct/formats/graphics/bmp.py @@ -55,7 +55,7 @@ def _decode(self, obj): #=============================================================================== bitmap_file = Struct("bitmap_file", # header - Const(String("signature", 2), "BM"), + Const(String("signature", 2), b"BM"), ULInt32("file_size"), Padding(4), ULInt32("data_offset"),