From 1e403e0effe8dd425e78479498ec94a05a93893c Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Tue, 19 Mar 2019 13:43:01 +0100 Subject: [PATCH] crypto: raise more specific error if msoffcrypto missing --- oletools/crypto.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oletools/crypto.py b/oletools/crypto.py index fe0322e..4648a31 100644 --- a/oletools/crypto.py +++ b/oletools/crypto.py @@ -90,7 +90,7 @@ from os.path import splitext, isfile from tempfile import mkstemp import zipfile from oletools.common.errors import CryptoErrorBase, WrongEncryptionPassword, \ - UnsupportedEncryptionError, MaxCryptoNestingReached + UnsupportedEncryptionError, MaxCryptoNestingReached, CryptoLibNotImported from olefile import OleFileIO try: @@ -203,9 +203,9 @@ WRITE_PROTECT_ENCRYPTION_PASSWORD = 'VelvetSweatshop' def _check_msoffcrypto(): - """raise an :py:class:`ImportError` if :py:data:`msoffcrypto` is `None`.""" + """Raise a :py:class:`CryptoLibNotImported` if msoffcrypto not imported.""" if msoffcrypto is None: - raise ImportError('msoffcrypto-tools could not be imported') + raise CryptoLibNotImported() def decrypt(filename, passwords=None, **temp_file_args): -- libgit2 0.21.4