Python unresolved import issue
See original GitHub issueWe believe the issue has been resolved, if not, please do open a new issue.
Locking this issue, to ensure we create a new issue.
Issue Type: Bug
I have python script which imports some libraries from subdirectories like this:
from easylog import EasyLog
from lib.fclib.misc import *
from lib.fclib.datelib import timestamp
with this directory hierachy:
myscript.py
lib
|-__init__.py
|-fclib
|-__init__.py
|-misc.py
|-datelib.py
But VSCODE shows warnings like “unresolved import ‘lib.fclib.misc’ Python(unresolved-import)”. And the functions in the libs have so many warnings about the codes.
Extension version: 2018.12.1 VS Code version: Code 1.30.1 (dea8705087adb1b5e5ae1d9123278e178656186a, 2018-12-18T18:12:07.165Z) OS version: Windows_NT x64 10.0.16299
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-5600U CPU @ 2.60GHz (4 x 2594) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: enabled video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled |
Memory (System) | 7.88GB (1.36GB free) |
Process Argv | |
Screen Reader | no |
VM | 67% |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:57
- Comments:35
Top Results From Across the Web
python - Pylint "unresolved import" error in Visual Studio Code
My solution · Go into the workspace folder (here workspaceRootFolder) and create a .env file · In this empty .env file, add the...
Read more >Python unresolved import: How to Solve Pylint Error
To solve unresolved import error in Python, set your Python path in your workspace settings. If you are working with Visual Studio Code...
Read more >Fix Python Unresolved Import in VSCode - LinuxPip
"Unresolved Import" is an error message produced by VSCode, not Python itself. The message simply means that VSCode cannot detect the correct ......
Read more >Unresolved import of local python file if main script is not at ...
Issue: When importing your own python modules which are in the workspace folder, but the main script is not in the root directory...
Read more >How to solve "unresolved import" (VS Code + Anaconda ...
Solving the " unresolved import " error in VS Code with 1 easy step!Resources:https://code.visualstudio.com/docs/ python /environmentshttps:// ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What @MagnusBrzenk hinted at also solved it for me.
Given the following example project structure:
What I did to resolve this issue:
.env
file.env
file add the linePYTHONPATH=codeFolder
(replace codeFolder with your folder name)"python.envFile": "${workspaceFolder}/.env"
to thesettings.json
The thumb ups may be confusing. I am having the same issue for the last two updates. When I
> reload window
that fixes.