Skip to content

AttributeError: 'list' object has no attribute 'split' #11851

Closed
@Torxed

Description

@Torxed

Crash Report

I suspect this is another one for #10201.
Mainly because I'm using Python v3.10.1 and this worked a few versions ago.
While running a github workflow, mypy crashes using mypy --module x --strict.

Traceback

This traceback is from the .github workflow execution:

Run mypy --strict --module ourkvm
Traceback (most recent call last):
  File "/usr/sbin/mypy", line 33, in <module>
    sys.exit(load_entry_point('mypy==0.930', 'console_scripts', 'mypy')())
  File "/usr/lib/python3.10/site-packages/mypy/__main__.py", line 12, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "/usr/lib/python3.10/site-packages/mypy/main.py", line 70, in main
    sources, options = process_options(args, stdout=stdout, stderr=stderr,
  File "/usr/lib/python3.10/site-packages/mypy/main.py", line 919, in process_options
    parse_config_file(options, set_strict_flags, config_file, stdout, stderr)
  File "/usr/lib/python3.10/site-packages/mypy/config_parser.py", line 207, in parse_config_file
    updates, report_dirs = parse_section(
  File "/usr/lib/python3.10/site-packages/mypy/config_parser.py", line 400, in parse_section
    v = ct(section.get(key))
  File "/usr/lib/python3.10/site-packages/mypy/config_parser.py", line 129, in <lambda>
    'exclude': lambda s: [p.strip() for p in s.split('\n') if p.strip()],
AttributeError: 'list' object has no attribute 'split'
Error: Process completed with exit code 1.

To Reproduce

This is the following workflow file I'm using:

on: [ push, pull_request ]
name: mypy type checking
jobs:
    mypy:
        runs-on: ubuntu-latest
        container:
            image: archlinux:latest
        steps:
            - uses: actions/checkout@v2
            - run: pacman --noconfirm -Syu python mypy python-pip
            - run: python -m pip install --upgrade pip
            - run: pip install fastapi pydantic
            - name: run mypy
              run: python --version
              run: mypy --version
              run: mypy --strict --module ourkvm

Your Environment

  • Mypy version used: 0.930 (v0.910 worked)
  • Mypy command-line flags: -m project --strict
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
python_version = "3.10"
exclude = ["tests/", "test.py"]

[[tool.mypy.overrides]]
module = "fastapi_resource_server.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "psutil.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "systemd.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "uvicorn.*"
ignore_missing_imports = true
  • Python version used: 3.10.1
  • Operating system and version: Arch Linux (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions