From 49e3c1e181b7fbf7b16bf9bf6e51d9233d9cbf59 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Nov 2014 16:27:11 +0100 Subject: [PATCH] raise an exception when the file isn't a blend --- modules/blendfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/blendfile.py b/modules/blendfile.py index 5248b36..97d374c 100644 --- a/modules/blendfile.py +++ b/modules/blendfile.py @@ -50,7 +50,7 @@ def open_blend(filename, access="rb"): bfile.is_compressed = False bfile.filepath_orig = filename return bfile - else: + elif magic[:2] == b'\x1f\x8b': log.debug("gzip blendfile detected?") handle.close() log.debug("decompressing started") @@ -68,6 +68,8 @@ def open_blend(filename, access="rb"): bfile.is_compressed = True bfile.filepath_orig = filename return bfile + else: + raise Exception("filetype not a blend or a gzip blend") def align(offset, by):