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)