I came across the new ModuleNotFoundError
exception in Python 3.6 which seems to be a subclass of ImportError
. The official documentation for ImportError says:
Raised when the import statement has trouble trying to load a module.
For ModuleNotFoundError:
Raised by import when a module could not be located.
Was it really necessary to introduce an exception like ModuleNotFoundError
? What is it's purpose ? Also when would an import
statement "have trouble loading a module" ?