Skip to content
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

Error creating (partial) type stub for defusedxml #2013

Closed
Molkree opened this issue Oct 29, 2021 · 2 comments
Closed

Error creating (partial) type stub for defusedxml #2013

Molkree opened this issue Oct 29, 2021 · 2 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@Molkree
Copy link

Molkree commented Oct 29, 2021

Environment data

  • Language Server version: v2021.10.3
  • OS and version: Win10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.10

Expected behaviour

Type stub created successfully, probably only for imported interfaces but the whole module would be fine as well.

Actual behaviour

An error occurred when creating type stub for 'defusedxml.ElementTree': Import 'defusedxml.ElementTree' could not be resolved

Logs

[Info  - 12:13:19 am] No configuration file found.
[Info  - 12:13:19 am] No pyproject.toml file found.
[Info  - 12:13:19 am] Setting pythonPath for service "cloned service": "c:\Users\mrmol\Downloads\LeetCode\.venv\Scripts\python.exe"
[Warn  - 12:13:19 am] stubPath c:\Users\mrmol\Downloads\LeetCode\typings is not a valid directory.
[Info  - 12:13:19 am] Assuming Python version 3.10
[Info  - 12:13:19 am] Assuming Python platform Windows
Search paths for c:\Users\mrmol\Downloads\LeetCode
  c:\Users\mrmol\.vscode\extensions\ms-python.vscode-pylance-2021.10.3\dist\typeshed-fallback\stdlib
  c:\Users\mrmol\Downloads\LeetCode
  c:\Users\mrmol\Downloads\LeetCode\typings
  c:\Users\mrmol\.vscode\extensions\ms-python.vscode-pylance-2021.10.3\dist\typeshed-fallback\stubs\...
  c:\Users\mrmol\.vscode\extensions\ms-python.vscode-pylance-2021.10.3\dist\bundled\stubs
  c:\Users\mrmol\AppData\Local\Programs\Python\Python310\DLLs
  c:\Users\mrmol\AppData\Local\Programs\Python\Python310\Lib
  c:\Users\mrmol\AppData\Local\Programs\Python\Python310
  c:\Users\mrmol\Downloads\LeetCode\.venv
  c:\Users\mrmol\Downloads\LeetCode\.venv\Lib\site-packages
[Error - 12:13:20 am] Import 'defusedxml.ElementTree' could not be resolved
[Error - 12:13:20 am] An error occurred when creating type stub for 'defusedxml.ElementTree': Import 'defusedxml.ElementTree' could not be resolved
[Info  - 12:13:20 am] Background analysis(3) root directory: c:\Users\mrmol\.vscode\extensions\ms-python.vscode-pylance-2021.10.3\dist
[Info  - 12:13:20 am] Background analysis(3) started
Background analysis message: setFileOpened
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
Background analysis message: setConfigOptions
Background analysis message: setImportResolver
Background analysis message: ensurePartialStubPackages
Background analysis message: setAllowedThirdPartyImports
Background analysis message: setTrackedFiles

Code Snippet / Additional information

This is a 3rd party package recommended by python.org.

import defusedxml.ElementTree as ET

I don't quite get why this import can't be resolved when generating type stub because it works fine in code, I get completions on ET. 🤔

Stub generation works fine if I import the whole module:

import defusedxml
@judej judej added the needs investigation Could be an issue - needs investigation label Nov 1, 2021
@github-actions github-actions bot removed the triage label Nov 1, 2021
@erictraut
Copy link
Contributor

This will be fixed in the next release.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Nov 3, 2021
@heejaechang
Copy link
Contributor

fixed in 2021.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants