|
34 | 34 | LOGGER.addHandler(log_handler) |
35 | 35 |
|
36 | 36 | # TODO unhardcode |
37 | | -LOGGER.setLevel(logging.INFO) |
| 37 | +LOGGER.setLevel(logging.DEBUG) |
38 | 38 |
|
39 | 39 |
|
40 | 40 | UnvalidatedPath = NewType("UnvalidatedPath", str) |
@@ -123,20 +123,26 @@ def get_validated_path(raw_path: str | None, allow_create: bool = False) -> Resu |
123 | 123 |
|
124 | 124 | def _import_module_from_path(path_to_module: str) -> Result[ModuleType, str]: |
125 | 125 | LOGGER.debug(f"{path_to_module=}") |
| 126 | + print(f"{path_to_module=}") |
126 | 127 | resolved_path = resolve_path(path_to_module) |
127 | 128 | LOGGER.debug(f"{resolved_path=}") |
128 | 129 | module_name = os.path.basename(resolved_path).replace(".py", "") |
129 | 130 |
|
130 | 131 | try: |
| 132 | + LOGGER.debug(f"running spec_from_file_location({module_name}, {resolved_path})") |
131 | 133 | spec = importlib.util.spec_from_file_location(module_name, resolved_path) |
132 | 134 | if spec is None: |
133 | 135 | return Err(f"Could not import module from path: {resolved_path}") |
134 | 136 | elif spec.loader is None: |
135 | 137 | return Err(f"Could not import module from path: {resolved_path} (no loader)") |
136 | 138 | else: |
| 139 | + LOGGER.debug(f"{spec=}") |
137 | 140 | module = importlib.util.module_from_spec(spec) |
| 141 | + LOGGER.debug(f"{module=}") |
138 | 142 | sys.modules[module_name] = module |
139 | | - spec.loader.exec_module(module) |
| 143 | + exec_module_result = spec.loader.exec_module(module) |
| 144 | + LOGGER.debug(f"{exec_module_result=}") |
| 145 | + LOGGER.debug(f"{module=}") |
140 | 146 | return Ok(module) |
141 | 147 | except Exception as e: |
142 | 148 | return core_utils.ErrWithTraceback(e) |
|
0 commit comments