From 9046b08a3cd7c4501df087ae93287778876c9a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 24 Nov 2020 14:56:29 +0100 Subject: [PATCH] fix: Do not fail on PyMISP import when mail-parser is not present --- pymisp/tools/emailobject.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pymisp/tools/emailobject.py b/pymisp/tools/emailobject.py index c6c7df7..ea554a2 100644 --- a/pymisp/tools/emailobject.py +++ b/pymisp/tools/emailobject.py @@ -28,14 +28,12 @@ class MISPMailObjectOutlookException(InvalidMISPObject): pass -if not mailparser: - raise MISPMailObjectOutlookException('mail-parser is required to use this module, you can install it by running pip3 install pymisp[email]') - - class EMailObject(AbstractMISPObjectGenerator): def __init__(self, filepath: Union[Path, str] = None, pseudofile: BytesIO = None, attach_original_email: bool = True, **kwargs): super().__init__("email", **kwargs) + if not mailparser: + raise MISPMailObjectOutlookException('mail-parser is required to use this module, you can install it by running pip3 install pymisp[email]') converted = False if filepath: