Skip to content

Commit 37b6c0d

Browse files
authored
fix the documentation and the error message of modpath_from_file (pylint-dev#2532)
The doc should clarify that the search will always include sys.path. The error message should reflect the actual paths used for checking.
1 parent 5210e61 commit 37b6c0d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

astroid/modutils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ def modpath_from_file_with_callback(
292292
return modpath
293293

294294
raise ImportError(
295-
"Unable to find module for {} in {}".format(filename, ", \n".join(sys.path))
295+
"Unable to find module for {} in {}".format(
296+
filename, ", \n".join(paths_to_check)
297+
)
296298
)
297299

298300

@@ -305,8 +307,8 @@ def modpath_from_file(filename: str, path: Sequence[str] | None = None) -> list[
305307
:param filename: file's path for which we want the module's name
306308
307309
:type Optional[List[str]] path:
308-
Optional list of path where the module or package should be
309-
searched (use sys.path if nothing or None is given)
310+
Optional list of paths where the module or package should be
311+
searched, additionally to sys.path
310312
311313
:raise ImportError:
312314
if the corresponding module's name has not been found

0 commit comments

Comments
 (0)