diff --git a/README.md b/README.md index dc01952..7ef9005 100644 --- a/README.md +++ b/README.md @@ -228,8 +228,8 @@ them to a local data structure. Logging Blocked Imports ----------------------- -To see which modules Vext is blocking set VEXT_LOG_BLOCKS instead of -standard ImportErrors, you will get ones like this: +To see which modules Vext is blocking set VEXT_LOG_BLOCKS. Instead of +standard ModuleNotFoundErrors, you will get ones like this: ```bash @@ -237,7 +237,7 @@ $ VEXT_LOG_BLOCKS=1 ``` ```python >>> import pyaudio -ImportError("Vext blocked import of pyaudio") +ModuleNotFoundError("Vext blocked import of pyaudio") ``` Remembering Blocked Imports @@ -252,7 +252,7 @@ vext.remember_blocks to True: >>> vext.blocked_imports set([]) >>> import pygtk -ImportError: +ModuleNotFoundError: >>> vext.blocked_imports set(["pygtk"]) ``` @@ -281,4 +281,3 @@ Thanks ruamel/venvgtk - for showing something like this is possible pymotw article on modules and imports - diff --git a/setup.py b/setup.py index 34f885f..74bb785 100644 --- a/setup.py +++ b/setup.py @@ -329,6 +329,7 @@ def run(self): 'vext.install', ], + python_requires=">=3.6", setup_requires=["setuptools>=18.0.1", "pip>=1.5.6"], install_requires=["ruamel.yaml>=0.11.10"], diff --git a/vext/gatekeeper/__init__.py b/vext/gatekeeper/__init__.py index a61cec1..8374a6b 100644 --- a/vext/gatekeeper/__init__.py +++ b/vext/gatekeeper/__init__.py @@ -184,7 +184,7 @@ def __init__(self, module_info, sitedir): def load_module(self, name): """ Only lets modules in allowed_modules be loaded, others - will get an ImportError + will get a ModuleNotFoundError (a type of ImportError) """ # Get the name relative to SITEDIR .. @@ -198,10 +198,10 @@ def load_module(self, name): if remember_blocks: blocked_imports.add(fullname) if log_blocks: - raise ImportError("Vext blocked import of '%s'" % modulename) + raise ModuleNotFoundError("Vext blocked import of '%s'" % modulename) else: # Standard error message - raise ImportError("No module named %s" % modulename) + raise ModuleNotFoundError("No module named %s" % modulename) if name not in sys.modules: try: @@ -229,7 +229,7 @@ def __init__(self, path_entry): except Exception as e: sys.stderr.write("Vext disabled: There was an issue getting the system site packages.\n") raise ImportError() - + if path_entry in (sitedir, GatekeeperFinder.PATH_TRIGGER): logger.debug("handle entry %s", path_entry) return