Skip to content

While checking package: 'IsADirectoryError' on directories not containing any '.py'-files #15979

@jp-berg

Description

@jp-berg

Crash Report

With the configuration listed below mypy seems to choke on the directory '2023-08-17_16-21-31'. (Paths have been shortened to the relevant parts)

Traceback

(.venv) pc: .../recipe2txt$ mypy --show-traceback
.../recipe2txt/test/reports_test4recipe2txt/2023-08-17_16-21-31: 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: 1.6.0+dev.010da0b2f48dc92be2f79495fd4551c92351868f
Traceback (most recent call last):
  File ".../recipe2txt/.venv/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/main.py", line 99, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/main.py", line 178, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 189, in build
    result = _build(
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 262, in _build
    graph = dispatch(sources, manager, stdout)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 2938, in dispatch
    process_graph(graph, manager)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 3336, in process_graph
    process_stale_scc(graph, scc, manager)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 3441, in process_stale_scc
    graph[id].finish_passes()
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 2364, in finish_passes
    with self.wrap_context():
  File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 2063, in wrap_context
    yield
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 2399, in finish_passes
    manager.report_file(self.tree, self.type_map(), self.options)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/build.py", line 866, in report_file
    self.reports.file(file, self.modules, type_map, options)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/report.py", line 91, in file
    reporter.on_file(tree, modules, type_map, options)
  File ".../recipe2txt/.venv/lib/python3.11/site-packages/mypy/report.py", line 174, in on_file
    with open(tree.path, "rb") as f:
         ^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '.../recipe2txt/test/reports_test4recipe2txt/2023-08-17_16-21-31'
.../recipe2txt/test/reports_test4recipe2txt/2023-08-17_16-21-31: : note: use --pdb to drop into pdb)

To Reproduce

TODO

Your Environment

  • Mypy version used: 1.6.0+dev.010da0b2f48dc92be2f79495fd4551c92351868f
  • Mypy command-line flags: --show-traceback
  • Mypy configuration options from pyproject.toml:
[tool.mypy]
python_version = '3.11'
strict = true
python_executable = ".venv/bin/python"
pretty = true
warn_unused_configs = true
exclude = 'test/test_*'
packages = ['recipe2txt', 'test']
linecount_report = 'report.txt'

[[tool.mypy.overrides]]
module = 'validators'
ignore_missing_imports = true
  • Python version used: 3.11.4
  • OS: Kubuntu 23.04 x86_64
  • Kernel: 6.2.0-27-generic

Output of the tree-command in the parent-directory of the crash-causing-directory

pc:.../recipe2txt/test/reports_test4recipe2txt$ tree
.
├── 2023-08-08_17-30-40
│   ├── output.md
│   ├── parameters.txt
│   └── urls_used.txt
├── 2023-08-08_17-38-55
│   ├── parameters.txt
│   └── urls_used.txt
├── 2023-08-16_12-43-46
├── 2023-08-16_12-44-22.zip
├── 2023-08-17_15-50-57.zip
├── 2023-08-17_15-51-53.zip
├── 2023-08-17_15-52-50.zip
├── 2023-08-17_15-53-50.zip
├── 2023-08-17_15-54-15
│   ├── output.md
│   ├── parameters.txt
│   └── urls_used.txt
├── 2023-08-17_15-54-15.zip
├── 2023-08-17_15-57-14.zip
├── 2023-08-17_16-18-54.zip
├── 2023-08-17_16-19-55.zip
├── 2023-08-17_16-21-31
│   ├── output.md
│   ├── parameters.txt
│   └── urls_used.txt
├── 2023-08-17_16-22-28.zip
├── 2023-08-17_16-28-32.zip
└── urls_shuffled.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions