You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
The analyzer sometimes does not resolve relative paths correctly. See the screen shot below.
The problem appears to be in PathResolverSnapshot.TryFindName which contains the following lines of code:
if (lastEdge.End.IsModule) {
return false;
}
I don't understand why this logic is needed. When I comment out these three lines, the relative paths resolve correctly and other imports also appear to resolve as expected.
In the example you gave above, if the module directory contained an __init__.py file, the import from test.py should succeed. Would you expect lastEdge.End.IsModule to evaluate to false if __init__.py is present?
To answer your question. lastEdge.End.IsModule evaluates to true in my case, which is what causes the .exceptions and '.image_builder` imports to be incorrectly flagged as errors.
Activity
MikhailArkhipov commentedon Dec 26, 2018
Alexander Sher (@AlexanderSher) owns the import subsystem.
AlexanderSher commentedon Jan 2, 2019
It is required for the case when there is a folder with the name of the module.
For example, for the following file structure:
and
test.py:import should be highlighted as invalid import.
In your case, what is the value of
lastEdge.End.ModulePathin that piece of code?erictraut commentedon Jan 2, 2019
In the example you gave above, if the
moduledirectory contained an__init__.pyfile, the import fromtest.pyshould succeed. Would you expectlastEdge.End.IsModuleto evaluate to false if__init__.pyis present?To answer your question.
lastEdge.End.IsModuleevaluates to true in my case, which is what causes the.exceptionsand '.image_builder` imports to be incorrectly flagged as errors.- Fix microsoft#509: PLS doesn't flag error in a relative import if i…
Two path resolution bug fixes
Two path resolution bug fixes
Cherry pick fixes from Release branch into PTVS branch (#578)