Closed eclazi closed 11 months ago
I am seeing the same pattern of Error reading settings and stubPath being invalid - irrespective of the path being set or not Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.3.0 Preview 5.0
Info: (16028) Pylance language server 2022.6.30 (pyright 212d1465) starting Info: (16028) Server root directory: c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist Log: Notebook support: Legacy Error: (16028) Error reading settings: TypeError: Cannot read properties of undefined (reading 'variableTypes') Info: (16028) No pyproject.toml file found. Warning: (16028) stubPath typings is not a valid directory.
Thanks for reporting this. It will be fixed in the next version.
I have updated to Version 17.4.0 Preview 2.0 and I am still seeing the warning "stubPath typings is not a valid directory". It appears regardless of whether Stubs Path is being set or not in Python analysis.
@excubo-jg Thanks, did the warning show up before or after you set the stubs path? In other words, if you set the stubs path, clear the pylance server log, reload the project, do you still see the warning?
Going to close this out. If the issue still persists, please reopen with the information requested. Thanks.đ
Apologies, I never received a notification about the request for information but received one now...
Setting a stubs path (copied the path from file manager so there should be not typos) immediately triggers the warning message in the log: Warning: (12020) stubPath typings is not a valid directory.
The message will continue to appear after closing and reloading the project
This is odd: I have deleted the entry in the stubs path but I'm still receiving the warning when restarting the project
This is odd: I have deleted the entry in the stubs path but I'm still receiving the warning when restarting the project
That's expected behavior, the stubs path is defaulted to "typings" when the input is blank and passed to the language server. You can ignore that warning. đ
Well, there is a directory "typings"... I think there shouldn't be a warning when the input is left blank and the default resolves to a valid directory.
Checked with another project without a typings-directory and there I also see the warning. That project is a trivial one and there is no need for additional typing information. Isn't it a bit too strong to issue a warning in that case? A missing pyproject.toml-file triggers one info entry when the project is loaded but no (further) warning messages
@excubo-jg The warning is just intended to be informational and help diagnose potential problems. You can ignore it if you are not using a stub path.
For this one, could you provide repro steps? Where is your typings directory? I wasn't able to repro this if the directory exists.
Well, there is a directory "typings"... I think there shouldn't be a warning when the input is left blank and the default resolves to a valid directory.
If the warning is informational I'd expect it to cause an Info-entry. To issue a warning is too strong imo
I played around and I have 3 repos all of which throw the warning in spite of a typings-directory being present. They all exhibit the same behavior:
directory typings does not exist -> Warning: (18008) stubPath c:\Users\Admin\Documents\Visual Studio 2022\Projects\projectname\typings is not a valid directory.
directory typings exists -> Warning: (11100) stubPath typings is not a valid directory.
directory typings gets created while the project is open in VS: output general: Error: Unknown change event received at e.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:92:23) at Object.update (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\node_modules\vscode-languageserver-textdocument\lib\esm\main.js:181:22) at t.SourceFile.setClientVersion (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\sourceFile.ts:676:49) at L.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\program.ts:361:35) at _0x4635b7.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\backgroundAnalysisProgram.ts:101:23) at C.setFileOpened (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\analyzer\service.ts:310:41) at _0x45764f.onDidOpenTextDocument (c:\program files\microsoft visual studio\2022\preview\common7\ide\extensions\microsoft\python\core\pylance\dist\pyright-internal\src\languageServerBase.ts:1247:35)
and output - pylance disappears
Hello! While we'd love to address all issues, our resources are limited, making it challenging to manage a large number of open requests. Pylance has recently made some improvements to stubPath
such that if python.analysis.stubPath
is unset, omit it from the configuration response rather than sending the default value ("typings"). This way the server knows that it's not set (rather than explicitly set to "typings") and can skip showing the warning in that case. This might have resolved your issue. If the problem persists and falls within the scope of PTVS, could you please open a new issue with:
Thanks for your understanding and assistance!
Describe the bug Setting stubs / search paths does not pass on to pylance server
Steps to Reproduce
Warning: (29816) stubPath typings is not a valid directory.
even though "typings" is not set in the stub pathExpected behavior pylance should observe analysis options
Additional context and screenshots
Configuration information (If you are providing a diagnostics file (see below), skip this section)
Diagnostics file The diagnostics file contains information such as the Python version, environments, loaded assemblies, configuration options, etc. This file makes it easier for us to reproduce and fix bugs, so we would really appreciate it if you could provide it to us. This file can be generated by going to Tools->Options->Python->Diagnostics. You can attach the file to this issue or email it to us at ptvshelp@microsoft.com. If you email it, please add a link to this issue.
This is not an option in VS 2022