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
Extension version (available under the Extensions sidebar): 2019.4.12954
OS and version: Windows_NT x64 10.0.17134
Python version (& distribution if applicable, e.g. Anaconda): 2.7.11 64-bit
Expected behaviour
With python.autoComplete.extraPaths set correctly, modules should import without issue.
Actual behaviour
I receive a Unresolved import 'moduleName' when using syntax of the form import workspace_folder.module as alt_name and if the .code-workspace file is in the same directory.
e.g.
Steps to reproduce:
Extract the following to a suitable location: myLib.zip
Inside myLib, open the Import_Bug.code-workspace file
Go to workspace settings and change the python.autoComplete.extraPaths to the folder containing myLib.
open libFunctions.py and see that import myLib.importMe as im has an unresolved import error.
I am aware that the organization of this workspace is sub-optimal, with the code-workspace file being inside the python library folder. However, with all paths being set correctly, the import should still succeed.
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Blank.
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)
which defines workspace root as workspace_folder. path has priority over python.autoComplete.extraPaths setting, so if extra path is parent folder to the path folder, it will be ignored for any module inside path. To fix the workspace, you can change path to ...
Activity
luabud commentedon May 9, 2019
Issue moved to microsoft/python-language-server #1060 via ZenHub
AlexanderSher commentedon May 9, 2019
There are two issues with this workspace:
path:which defines workspace root as
workspace_folder.pathhas priority overpython.autoComplete.extraPathssetting, so if extra path is parent folder to thepathfolder, it will be ignored for any module insidepath. To fix the workspace, you can changepathto...myLib.zipin attachment contains modules and packages that don't match naming conventions: https://www.python.org/dev/peps/pep-0008/#package-and-module-names We still support these files, but they can't be referenced as imports.