Tâche #35808
Scénario #35783: EOLE 2.10 : "ModuleNotFoundError: No module named 'imp'"
Étude
Début:
01/10/2022
Echéance:
% réalisé:
100%
Restant à faire (heures):
0.0
Historique
#1 Mis à jour par Benjamin Bohard il y a environ 2 mois
- Statut changé de Nouveau à En cours
#2 Mis à jour par Benjamin Bohard il y a environ 2 mois
Recherch des import du module imp dans les projets:
creole/creole/eosfunc.py: import imp python-nevow/nevow/test/test_howtolistings.py:import imp python-nevow/examples/todo/dispatcher.py:import imp zephir/services/data-model-eole-develop/seed/release/eole-2.6/2.6.10/applicationservice/creole/creole_funcs/eosfunc.py:import imp zephir/services/data-model-eole-develop/seed/release/eole-2.5/2.5.2/applicationservice/creole/creole_funcs/eosfunc.py:import imp zephir/services/data-model-eole-develop/seed/release/eole-2.7/2.7.1/applicationservice/creole/creole_funcs/eosfunc.py:import imp ead/backend/lib/actionlist.py:import imp eole-dhcp/tests/test_desactivation.py:import imp, sys eole-dhcp/tests/test_reserved.py:import imp eole-dhcp/tests/test_subnets.py:import imp eole-dhcp/tests/test_conversion_ead2.py:import imp eole-dhcp/tests/test_delete_reserved.py:import imp python-pyeole/pyeole/ihm.py: import imp
#3 Mis à jour par Benjamin Bohard il y a environ 2 mois
Creole¶
L'utilisation du module imp est déjà conditionné à la version de l’interpréteur python dans eosfunc :
if sys.version_info[0] >= 3: import importlib.util else: import imp
def load_funcs(force_reload=False): […] spec = importlib.util.spec_from_file_location(name, mod_file) mod_perso = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod_perso) else: mod_perso = imp.load_source(name, mod_file)
python-nevow¶
Dans python-nevow, utilisation de la méthode reload du module imp dans le setup et le teardown du test howtolistings.
EAD¶
Dans l'EAD, utilisation non protégée :
import imp […] def load_action_pyfile(action_file, action_dir): """ Importe un fichier .py """ try: if debug: log.msg(" * Chargement de \"%s.py\"" % join(action_dir, action_file)) filename, pathname, desc = imp.find_module(action_file, [action_dir]) imp.load_module(action_file, filename, pathname, desc) except ImportError: log.err("Error while loading module : \"%s\"" % (action_file)) except Exception as msg: error.get_out("Error while loading the action file \"%s\": %s" % (
eole-dhcp¶
Dans eole-dhcp, utilisation dans les tests :
import imp, sys […] def setup_module(module): module.HERE = dirname(abspath(__file__)) PATH = normpath(join(HERE, '..', 'extra', 'dhcp', 'salt')) fch = open(normpath(join(PATH, 'custom.py')), 'r') module.custom_desactivation = imp.load_module('custom', fch, normpath(join(PATH, 'custom.py')), ('.py', 'U', 1))
import imp […] def setup_module(module): module.HERE = dirname(abspath(__file__)) PATH = normpath(join(HERE, '..', 'extra', 'dhcp', 'salt')) fch = open(normpath(join(PATH, 'custom.py')), 'r') module.custom = imp.load_module('custom', fch, normpath(join(PATH, 'custom.py')), ('.py', 'U', 1))
import imp […] def setup_module(module): module.HERE = dirname(abspath(__file__)) PATH = normpath(join(HERE, '..', 'extra', 'dhcp', 'salt')) fch = open(normpath(join(PATH, 'custom.py')), 'r') module.custom = imp.load_module('custom', fch, normpath(join(PATH, 'custom.py')), ('.py', 'U', 1))
import imp […] def setup_module(module): […] module.custom = imp.load_module('custom', fch, normpath(join(PATH, 'custom.py')), ('.py', 'U', 1)) PATH = normpath(join(HERE, '..', 'extra', 'dhcp', 'salt')) fch = open(normpath(join(PATH, 'custom.py')), 'r') module.dhcp_custom = imp.load_module('dhcp_custom', fch, normpath(join(PATH, 'custom.py')), ('.py', 'U', 1)) module.TEST_DATA_PATH = join(HERE, 'data')
import imp […] def setup_module(module): module.HERE = dirname(abspath(__file__)) PATH = normpath(join(HERE, '..', 'extra', 'dhcp', 'salt')) fch = open(normpath(join(PATH, 'custom.py')), 'r') module.custom = imp.load_module('custom', fch, normpath(join(PATH, 'custom.py')), ('.py', 'U', 1))
pyeole¶
Déjà traité.
#4 Mis à jour par Benjamin Bohard il y a environ 2 mois
- Statut changé de En cours à À valider
#5 Mis à jour par Laurent Gourvenec il y a environ un mois
- % réalisé changé de 0 à 100
#6 Mis à jour par Laurent Gourvenec il y a environ un mois
- Statut changé de À valider à Résolu
#7 Mis à jour par Joël Cuissinat il y a environ un mois
- Statut changé de Résolu à Fermé
- Restant à faire (heures) mis à 0.0