Skip to content

Commit

Permalink
fix: Don't try loading packages from relative paths
Browse files Browse the repository at this point in the history
Issue-145: #145
  • Loading branch information
pawamoy committed Apr 2, 2024
1 parent 3cf7055 commit bd73497
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/mkdocstrings_handlers/python/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,16 @@ def collect(self, identifier: str, config: Mapping[str, Any]) -> CollectorItem:
try:
for pre_loaded_module in final_config.get("preload_modules") or []:
if pre_loaded_module not in self._modules_collection:
loader.load(pre_loaded_module, find_stubs_package=final_config["find_stubs_package"])
loader.load(module_name, find_stubs_package=final_config["find_stubs_package"])
loader.load(
pre_loaded_module,
try_relative_path=False,
find_stubs_package=final_config["find_stubs_package"],
)
loader.load(
module_name,
try_relative_path=False,
find_stubs_package=final_config["find_stubs_package"],
)
except ImportError as error:
raise CollectionError(str(error)) from error
unresolved, iterations = loader.resolve_aliases(
Expand Down

0 comments on commit bd73497

Please sign in to comment.