import time
This fails in the latest version of Language server

Starting Microsoft Python language server.
[Info - 10:59:43 AM] GetCurrentSearchPaths /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/bin/python
[Info - 10:59:43 AM] SearchPaths:
[Info - 10:59:43 AM] /private/var/folders/22/0kj01mp12l3dsd1vw9vhfs6c0000gn/T/gpd33mwx.z0b
[Info - 10:59:43 AM] /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7
[Info - 10:59:43 AM] /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/lib-dynload
[Info - 10:59:43 AM] /Users/donjayamanne/.pyenv/versions/3.7.0/lib/python3.7
[Info - 10:59:43 AM] /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/site-packages
[Info - 10:59:43 AM] /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python37.zip;/Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7;/Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/lib-dynload;/Users/donjayamanne/.pyenv/versions/3.7.0/lib/python3.7;/Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/site-packages;
[Info - 10:59:43 AM] /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/bin
[Info - 10:59:47 AM] Microsoft Python Language Server version 0.2.16.0
[Info - 10:59:47 AM] Initializing for /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/bin/python
[Info - 12:20:37 PM] Reloading modules...
[Info - 12:20:40 PM] done.
[Info - 12:20:40 PM] Analysis restarted.
On my machine, it works fine:

Do you have any exceptions?
I think the /Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python37.zip;/Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7;/Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/lib-dynload;/Users/donjayamanne/.pyenv/versions/3.7.0/lib/python3.7;/Users/donjayamanne/.local/share/virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/site-packages;
i.e. unseparated paths are the problem. Old code separated paths itself. Basically part of https://github.com/Microsoft/python-language-server/issues/720
Absolutely no exceptions, reloaded VSC and started working again... Note while this failed everything else worked with the language server..
Most probably #700 then
I think I know whats wrong.
Came across this a number of times yesterday and today.
Today, import sys had the exact same problem.
Unfortunately the problem went away before I could grab any screenshots.
I think the problem is, the problems are listed before the module resolution completes.
Came across problems with import time, import sys
I think this can be quite confusing and annoying to users when there are underlines under such imports that are used and are standard.
Identified in version Microsoft Python Language Server version 0.2.23.0
@DonJayamanne - is is just a squiggle or completion is missing too? I think the problem is, the problems are listed before the module resolution completes. - I guess completion does work but we haven't updated the diagnostics?
Happened again for os, dataclass, etc...
Didn't check intellisense, will check next time it happens.

Just replicated for import sys

Here are the logs:
##########Linting Output - flake8##########
Starting Microsoft Python language server.
[Info - 1:15:48 PM] GetCurrentSearchPaths /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/bin/python
[Info - 1:15:48 PM] Python search paths:
[Info - 1:15:48 PM] /private/var/folders/22/0kj01mp12l3dsd1vw9vhfs6c0000gn/T/thmraoix.apg
[Info - 1:15:48 PM] /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7
[Info - 1:15:48 PM] /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/lib-dynload
[Info - 1:15:48 PM] /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7
[Info - 1:15:48 PM] /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/site-packages
[Info - 1:15:48 PM] Configuration search paths:
[Info - 1:15:48 PM] /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python37.zip;/Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7;/Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/lib-dynload;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7;/Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/lib/python3.7/site-packages;
[Info - 1:15:48 PM] /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/bin
[Info - 1:15:53 PM] Microsoft Python Language Server version 0.2.23.0
[Info - 1:15:53 PM] Initializing for /Users/donjayamanne/.virtualenvs/pythonVSCode-5rU-mS3t/bin/python
[Info - 1:18:48 PM] Reloading modules...
[Info - 1:18:50 PM] done.
[Info - 1:18:50 PM] Analysis restarted.
##########Linting Output - flake8##########
##########Linting Output - flake8##########
##########Linting Output - flake8##########
##########Linting Output - flake8##########
11,4,E,E999:SyntaxError: invalid syntax
12,1,E,E402:module level import not at top of file
13,1,E,E402:module level import not at top of file
##########Linting Output - flake8##########
11,4,E,E999:SyntaxError: invalid syntax
12,1,E,E402:module level import not at top of file
13,1,E,E402:module level import not at top of file
##########Linting Output - flake8##########
##########Linting Output - flake8##########
9,4,E,E999:SyntaxError: invalid syntax
10,1,E,E402:module level import not at top of file
11,1,E,E402:module level import not at top of file
13,1,E,E402:module level import not at top of file
14,1,E,E402:module level import not at top of file
##########Linting Output - flake8##########
9,7,W,W291:trailing whitespace
9,7,E,E999:SyntaxError: invalid syntax
10,1,E,E402:module level import not at top of file
11,1,E,E402:module level import not at top of file
13,1,E,E402:module level import not at top of file
14,1,E,E402:module level import not at top of file
##########Linting Output - flake8##########
9,1,F,F811:redefinition of unused 'sys' from line 8
##########Linting Output - flake8##########
##########Linting Output - flake8##########
9,3,E,E999:SyntaxError: invalid syntax
10,1,E,E402:module level import not at top of file
11,1,E,E402:module level import not at top of file
13,1,E,E402:module level import not at top of file
14,1,E,E402:module level import not at top of file
##########Linting Output - flake8##########
10,1,E,E402:module level import not at top of file
11,1,E,E402:module level import not at top of file
13,1,E,E402:module level import not at top of file
14,1,E,E402:module level import not at top of file
##########Linting Output - flake8##########
Set you "python.analysis.logLevel": "Trace", pretty please
Left it on, next time I see it i'll post more information. Try to retrace my steps.
Managed to replicate, though not sure when it stopped working, either way, here are the logs an other info:
import sys & import time not found

I haven't been experiencing this issue lately.
Hence closing it, possible some changes in the latest versions have resolved this issue.
Its back, saw this a number of times today.

Here are the logs:
logs.log
May be related. The following test is unpredictable. Sometimes sys is unresolved, sometimes it is compiled builtin but analysis is empty.
public async Task File() {
const string code = @"
import sys
sys.
";
var uri = await TestData.CreateTestSpecificFileAsync("a.py", code);
await CreateServicesAsync(PythonVersions.LatestAvailable3X, uri.AbsolutePath);
var rdt = Services.GetService<IRunningDocumentTable>();
var doc = rdt.OpenDocument(uri, null, uri.AbsolutePath);
var analysis = await doc.GetAnalysisAsync(Timeout.Infinite);
var cs = new CompletionSource(new PlainTextDocumentationSource(), ServerSettings.completion);
var completions = cs.GetCompletions(analysis, new SourceLocation(3, 5));
completions.Should().HaveLabels("argv", "path", "exit");
}
See also #779
Same problem with import sys.

[Info - 9:05:10 PM] Reloading modules...
[Info - 9:05:12 PM] done.
[Info - 9:05:12 PM] Analysis restarted.
is suspicious. Looks like something is detected and changed and modules getting reloaded triggering the issue.
Yes, looks like restart of analysis is the issue.

@AlexanderSher - I think https://github.com/Microsoft/python-language-server/pull/871 addressed this?
Yes
This needs to be reopened. I see this problem today - #1430
Version: 1.37.0 (user setup)
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
I agree this needs to be re-opened. I have the problem as well. i am on the latest version of vscode on a mac.
@MikhailArkhipov
Same problem here. Apparently happening only in python native libs (sys, traceback, pdb, logging).
Version: 1.37.1
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:16:34.800Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.5.0
Same problem
If it happens after "analysis restarted", see #1156.
Still failing for me on "import sys"...
Reloading the window fixes it _sometimes_. Maybe #1156?
Most helpful comment
This needs to be reopened. I see this problem today - #1430
Version: 1.37.0 (user setup)
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362