Skip to content

"has no attribute" then suggests another missing attribute #9084

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

Closed
Dreamsorcerer opened this issue Jul 1, 2020 · 3 comments · Fixed by #9237
Closed

"has no attribute" then suggests another missing attribute #9084

Dreamsorcerer opened this issue Jul 1, 2020 · 3 comments · Fixed by #9237

Comments

@Dreamsorcerer
Copy link
Contributor

Output in a mypy run:

vaults.py:14: error: Module 'datatypes' has no attribute 'VaultDataResponse'; maybe "VaultSummaryResponse"?  [attr-defined]
vaults.py:14: error: Module 'datatypes' has no attribute 'VaultSummaryResponse'; maybe "VaultDataResponse"?  [attr-defined]

Hopefully the error in the above output is self explanatory, it's contradicting itself.

@Dreamsorcerer
Copy link
Contributor Author

Note that the attributes do exist, but I'm running with the --no-implicit-reexport option. So, it looks like the suggestions are generated without that option or something.

In this case, as the variable does exist, the suggestion should probably indicate something about implicit reexport, rather than another variable.

@JukkaL
Copy link
Collaborator

JukkaL commented Jul 3, 2020

Yeah, this is a bug. Would you like to contribute a fix -- it should be pretty easy? You can look at the implementation of --no-implicit-reexport for context (#6562).

@Dreamsorcerer
Copy link
Contributor Author

I can probably look at it in a few weeks.

hauntsaninja added a commit to hauntsaninja/mypy that referenced this issue Oct 18, 2022
Also only suggest public API for attribute access suggestions

Fixes python#13908

Accomplishes a similar thing to python#9084 (the logic from there could be
improved too, will send a PR for that next)
hauntsaninja added a commit that referenced this issue Oct 19, 2022
Also only suggest public API for attribute access suggestions

Fixes #13908

Accomplishes a similar thing to #9084 (the logic from there could be
improved too, will send a PR for that next)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants