Skip to content

Commit

Permalink
Use ModuleNotFoundError instead of ImportError where appropriate.
Browse files Browse the repository at this point in the history
The new exception was introduced in Python 3.6.
  • Loading branch information
Nikratio committed Jan 3, 2021
1 parent 7df147f commit c808426
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rst/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ that is not the case.
To check if a specific module :var:`<module>` is installed, execute
:samp:`python3 -c 'import {<module>};
print({<module>}.__version__)'`. This will result in an
`ImportError` if the module is not installed, and will print the
`ModuleNotFoundError` if the module is not installed, and will print the
installed version if the module is installed.


Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

try:
import setuptools
except ImportError:
except ModuleNotFoundError:
raise SystemExit('Setuptools package not found. Please install from '
'https://pypi.python.org/pypi/setuptools')
from setuptools import Extension
Expand Down Expand Up @@ -54,7 +54,7 @@ def run(self):
try:
from sphinx.application import Sphinx
from docutils.utils import SystemMessage
except ImportError:
except ModuleNotFoundError:
raise SystemExit('This command requires Sphinx to be installed.') from None

fix_docutils()
Expand Down
2 changes: 1 addition & 1 deletion src/s3ql/backends/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

try:
import google.auth as g_auth
except ImportError:
except ModuleNotFoundError:
g_auth = None


Expand Down
2 changes: 1 addition & 1 deletion src/s3ql/block_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

try:
from contextlib import asynccontextmanager
except ImportError:
except ModuleNotFoundError:
from async_generator import asynccontextmanager

# standard logger for this module
Expand Down
2 changes: 1 addition & 1 deletion src/s3ql/multi_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

try:
from contextlib import asynccontextmanager
except ImportError:
except ModuleNotFoundError:
from async_generator import asynccontextmanager

__all__ = [ "MultiLock" ]
Expand Down

0 comments on commit c808426

Please sign in to comment.