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

--html-report cannot be used with namespace-packages, explicit-package-bases and -p: IsADirectoryError #11334

Closed
earshinov opened this issue Oct 14, 2021 · 1 comment · Fixed by #11338
Labels
bug mypy got something wrong

Comments

@earshinov
Copy link

Example repo

To Reproduce

$ git clone https://github.com/earshinov/mypy-htmlreport-isadirectoryerror.git
$ cd mypy-htmlreport-isadirectoryerror

...and follow the instructions from README.

In short, the problem is an IsADirectoryError when trying to pass both -p and --html-report:

$ poetry run mypy -p folder --html-report=mypy-report --show-traceback
/mnt/c/tmp/mypy-bug/folder/subfolder: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.910
Traceback (most recent call last):
  File "/home/user/.cache/pypoetry/virtualenvs/mypy-bug-3PnpPrM--py3.8/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "mypy/build.py", line 1955, in wrap_context
  File "mypy/build.py", line 2205, in finish_passes
  File "mypy/build.py", line 818, in report_file
  File "mypy/report.py", line 83, in file
  File "mypy/report.py", line 482, in on_file
  File "mypy/report.py", line 131, in iterate_python_lines
  File "/usr/lib/python3.8/tokenize.py", line 392, in open
    buffer = _builtin_open(filename, 'rb')
IsADirectoryError: [Errno 21] Is a directory: 'folder/subfolder'
/mnt/c/tmp/mypy-bug/folder/subfolder: : note: use --pdb to drop into pdb
Generated HTML report (via XSLT): /mnt/c/tmp/mypy-bug/mypy-report/index.html

Expected Behavior

It should be possible to use -p and --html-report together.

Actual Behavior

-p and --html-report used together cause an IsADirectoryError.

Your Environment

  • Windows 10 / WSL / Ubuntu 20.04
  • Python 3.8.10
  • mypy 0.910

Reproducible with mypy@master (a114826) as well.

mypy.ini:

[mypy]
explicit_package_bases = True
ignore_missing_imports = True
namespace_packages = True
# As recommended in PEP-484
# - https://github.com/python/typing/issues/275
# - https://www.python.org/dev/peps/pep-0484/#union-types
no_implicit_optional = True
show_column_numbers = True
show_error_codes = True
strict = True
@earshinov earshinov added the bug mypy got something wrong label Oct 14, 2021
@sobolevn
Copy link
Member

Thanks a lot, @earshinov! Your reproduction really helped.
#11338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants