From 6eb2006269318abb7eadd03178cf3f2fa7df7a5f Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Sun, 19 Oct 2014 15:23:16 +1300 Subject: [PATCH] Added file check to icon changing. --- pe.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pe.py b/pe.py index 21a315b..5b8ff28 100644 --- a/pe.py +++ b/pe.py @@ -1222,10 +1222,14 @@ class PEFile(Printable): of the file, but that did not work. Comments were left as history to what I attempted. """ + icon_path = os.path.expanduser(icon_path) if pm is None: raise Exception('PythonMagick is required to run this function.') + if not os.path.exists(icon_path): + raise Exception('Icon {} does not exist'.format(icon_path)) + resource_section = self.sections['.rsrc'] g_icon_dir = self.get_directory_by_type(ResourceTypes.Group_Icon)