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

reportMissingModuleSource Import "py.xml" could not be resolved from sourcePylance #2357

Closed
zeusweb-1 opened this issue Feb 9, 2022 · 3 comments

Comments

@zeusweb-1
Copy link

Environment

Windows 10
Pylance v2022.2.0
Python v2022.0.1814523869
Pytest BDD v0.3.17

Python 3.10.2 with venv

The following code reports a problem in VSCode
from py.xml import html

In 'normal' python the following appears to work correctly
from py.xml import html
print ( html.th('Ticket'))

Which prints the following

Ticket

The version of py listed by pip is
py 1.11.0

@github-actions github-actions bot added the triage label Feb 9, 2022
@debonte debonte self-assigned this Feb 9, 2022
@debonte debonte added the needs investigation Could be an issue - needs investigation label Feb 9, 2022
@debonte
Copy link
Contributor

debonte commented Feb 9, 2022

Dynamic behavior?

@github-actions github-actions bot removed the triage label Feb 9, 2022
@browneye1826
Copy link

Same issue here. In Conda env, but Pylance is not seeing the modules.

@judej judej added the P2 label Mar 1, 2022
@debonte debonte added dynamic behavior and removed needs investigation Could be an issue - needs investigation labels Jun 9, 2022
@debonte
Copy link
Contributor

debonte commented Jun 9, 2022

reportMissingModuleSource means that Pylance found the type stub for the module (xml.pyi) but couldn't find the implementation. See the documentation of reportMissingModuleSource.

This is happening because the implementation of py.xml is generated dynamically via `_xmlgen.py'.

As a static analysis tool that doesn't execute Python code, we don't have a good way to handle dynamic behavior of this sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants