| 1 |
From: Georges Khaznadar <[email protected]> |
| 2 |
Date: Sun, 7 Dec 2025 17:59:56 +0100 |
| 3 |
Subject: no_imp_modules |
| 4 |
|
| 5 |
=================================================================== |
| 6 |
--- |
| 7 |
wxgeometrie/dependances.py | 13 +++---------- |
| 8 |
wxgeometrie/initialisation.py | 2 +- |
| 9 |
2 files changed, 4 insertions(+), 11 deletions(-) |
| 10 |
|
| 11 |
diff --git a/wxgeometrie/dependances.py b/wxgeometrie/dependances.py |
| 12 |
index 66b0439..dfcff9a 100644 |
| 13 |
--- a/wxgeometrie/dependances.py |
| 14 |
+++ b/wxgeometrie/dependances.py |
| 15 |
@@ -22,7 +22,7 @@ |
| 16 |
# Ce module sert à tester que toutes les dépendances sont satisfaites, |
| 17 |
# et à y remédier dans le cas contraire (si possible). |
| 18 |
|
| 19 |
-import sys, imp, platform, os, shutil, subprocess |
| 20 |
+import sys, importlib, platform, os, shutil, subprocess |
| 21 |
|
| 22 |
# ------------------------------------------------------------------------------ |
| 23 |
# CONFIGURATION |
| 24 |
@@ -92,15 +92,8 @@ def tester_dependances(): |
| 25 |
for module in dependances: |
| 26 |
module_name = module |
| 27 |
try: |
| 28 |
- # imp.find_module() doesn't support submodules. |
| 29 |
- path = None |
| 30 |
- while '.' in module: |
| 31 |
- module, submodule = module.split('.', 1) |
| 32 |
- f, filename, description = imp.find_module(module, path) |
| 33 |
- module = submodule |
| 34 |
- path = [filename] |
| 35 |
- imp.find_module(module, path) |
| 36 |
- except ImportError: |
| 37 |
+ importlib.import_module(module) |
| 38 |
+ except ModuleNotFoundError: |
| 39 |
modules_manquants.append(module_name) |
| 40 |
|
| 41 |
|
| 42 |
diff --git a/wxgeometrie/initialisation.py b/wxgeometrie/initialisation.py |
| 43 |
index 5f470c6..ee72cd0 100644 |
| 44 |
--- a/wxgeometrie/initialisation.py |
| 45 |
+++ b/wxgeometrie/initialisation.py |
| 46 |
@@ -20,7 +20,7 @@ |
| 47 |
|
| 48 |
import time |
| 49 |
t0 = time.time() |
| 50 |
-import sys, os, itertools, traceback, imp, subprocess |
| 51 |
+import sys, os, itertools, traceback, subprocess |
| 52 |
from os.path import dirname, realpath, normpath |
| 53 |
|
| 54 |
# Emplacement du module python nommé wxgeometrie |