]> git.openstreetmap.org Git - nominatim.git/commitdiff
use more generic ImportError to check for module
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 23 Apr 2021 19:10:19 +0000 (21:10 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sat, 24 Apr 2021 13:13:06 +0000 (15:13 +0200)
ModuleNotFoundError was only introduced in Python 3.6.

nominatim/db/async_connection.py
nominatim/tools/replication.py

index c5d6872bf0790abfaa10f7b07d2567ba0913663d..361fe0757365c40db30eb4b3e9246ed3564e39ad 100644 (file)
@@ -14,7 +14,7 @@ from psycopg2.extras import wait_select
 try:
     import psycopg2.errors # pylint: disable=no-name-in-module,import-error
     __has_psycopg2_errors__ = True
-except ModuleNotFoundError:
+except ImportError:
     __has_psycopg2_errors__ = False
 
 LOG = logging.getLogger()
index a0a741e8ff4ae87155ff38853784d1af41b66ce3..0d003d6a9dfba4d613c8916359b99d2a5edc19ca 100644 (file)
@@ -13,7 +13,7 @@ from ..errors import UsageError
 try:
     from osmium.replication.server import ReplicationServer
     from osmium import WriteHandler
-except ModuleNotFoundError as exc:
+except ImportError as exc:
     logging.getLogger().fatal("pyosmium not installed. Replication functions not available.\n"
                               "To install pyosmium via pip: pip3 install osmium")
     raise UsageError("replication tools not available") from exc