Skip to content

Commit

Permalink
still debuging github
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Jul 10, 2024
1 parent 470c5ca commit 6a72552
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 10 additions & 4 deletions grid2op/Environment/baseEnv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4080,14 +4080,20 @@ def _aux_gen_classes(cls_other, sys_path, _add_class_output=False):
except FileExistsError:
pass
env_path, env_nm = os.path.split(sub_repo)
sys.path.append(env_path)
if env_path not in sys.path:
sys.path.append(env_path)
super_supermodule = importlib.import_module(env_nm)
tmp_nm = f"{env_nm}.{tmp_nm}"
sub_repo = super_supermodule
super_module = importlib.import_module(tmp_nm, sub_repo)
print(f"DEBUG CI: {sorted(os.listdir(sub_repo))}")
print(f"DEBUG CI: {sorted(os.listdir(os.path.join(sub_repo, tmp_nm)))}")
module = importlib.import_module(f"{tmp_nm}.{nm_}", super_module)
try:
module = importlib.import_module(f"{tmp_nm}.{nm_}", super_module)
except ModuleNotFoundError as exc_:
print(f"DEBUG CI: {sys.path}")
print(f"DEBUG CI: {sorted(os.listdir(sub_repo))}")
print(f"DEBUG CI: {sorted(os.listdir(os.path.join(sub_repo, tmp_nm)))}")
module = importlib.import_module(f"{tmp_nm}.{nm_}", super_module)
raise EnvError("Impossible to load the class") from exc_
print(f"\tsuccess for {cls_other.__name__}")
cls_res = getattr(module, cls_other.__name__)
return str_import, cls_res
Expand Down
2 changes: 2 additions & 0 deletions grid2op/tests/automatic_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def test_all_classes_from_file(self,
name_action_cls = self._aux_get_act_cls().format(classes_name)

name_action_cls = name_action_cls.format(classes_name)
print("DEBUG CI making the env")
env = self._aux_make_env(env)
print("DEBUG CI env made")
names_cls = [f"ActionSpace_{classes_name}",
f"_BackendAction_{classes_name}",
f"CompleteAction_{classes_name}",
Expand Down

0 comments on commit 6a72552

Please sign in to comment.