-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple invalid "cannot access member for type object" #905
Comments
I'm not able to repro the errors you're seeing. It looks like you have some extension installed that displays diagnostics inline. What extension is that? I wonder if that's the cause of the problem? When you see these errors, do they also appear in the Problems tab? You said that the errors don't initially appear but do after several saves. That sounds like a caching issue somewhere. |
I use error lens (https://github.com/usernamehw/vscode-error-lens) to display the error inline. The errors also appear in the problems tab. I'm not completely sure what it triggers it; I cannot always trigger it immediately, but after a few minutes working with, at least, this repository, they always appear. I've disabled error lens and a couple other extensions that I thought may affect linting, but that doesn't seem to help. |
I seem to have tracked it down to the format on save option. My vscode config for this project includes "python.formatting.provider": "black",
"[python]" : {
"editor.codeActionsOnSave": {"source.organizeImports": true},
"editor.formatOnSave": true
} If I comment the |
That really curious. We do no formatting or organizing, the Python extension does. Maybe there was something that changed in their most recent release, but nothing about this issue to me would indicate that these changes would cause sync issues to this extent... |
Is it possible that this is related to the recent file watcher changes? |
Maybe, if the external tools are operating directly on the files, but it's my understanding that they take back the changes via stdout and then call VS Code to change them, so they can handle file versioning. If not, then maybe it's some incongruency between the background and foreground thread file states when a file change event comes in, but we didn't change how the analyses are retriggered. With a @albireox If you downgrade to 2021.1.2, does your issue go away? |
@jakebailey Yes, it seems it doesn't happen with 2021.1.2. However, just downgrading wasn't enough. I had to restart VSCode for the errors to go away and not return. |
VS Code cannot downgrade extensions without a full reload (once an extension is loaded, it's loaded forever), so that's expected. The even more verbose log setting I mentioned above may provide some more info, but I'm sort of wondering if we'll have enough info from that without also getting a full LSP trace to see the correlation... If it's that reproducible, can you try creating a {
"verboseOutput": true
} And reloading to capture the logs on 2021.1.3? If you could just drag the log file into the issue comment, that'd be preferred (as I am expecting it to be larger than your other logs so far). |
Here are the logs copied from the Python Language Server tab with 2021.1.2 and 3. Is that what you need? For each version I kept the formatting on save active and modified a couple files and saved them. |
I do see more FS events in the logs, yeah, including some for I assume it's |
That's correct, that's one of the files that get the multiple errors. The code is here https://github.com/sdss/archon/blob/main/archon/controller/controller.py |
Okay, I can see what's happening here, at least. We have a little element to try and prevent events related to tempfiles, but in this case, black is now producing a filename slightly different than what we hacked in previously to avoid triggering on those files from being deleted. I'll make a change so that we also ignore |
This issue has been fixed in version 2021.2.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202120-3-february-2021 |
I can confirm that it's fixed with the latest insiders and 2021.2.0. Thanks! |
Thanks for being so quick to fix this. You all are badass! |
Environment data
Expected behaviour
No errors.
Actual behaviour
I'm seeing multiple errors that appear to be incorrect. They mostly seem to be of type "cannot access member XXX for type object", but also "no overloads for XXX match parameters and others". For example, this code
produces the errors seen in the screenshot. The errors don't appear immediately, sometimes it takes a couple saves before they pop up, but then they usually stay.
When I hover over the variables (
rtype
,rcid
) they show the correct types, and in fact the docstring for, for exaple,decode
is shown correctly.If I run
pyright
with node directly, none of these errors show up.Logs
The text was updated successfully, but these errors were encountered: