Skip to content

Flake 8 - StringIO wrapper error with [FLAKE8 - AttributeError: '_io.StringIO' object has no attribute 'buffer'] #81

@klausmyrseth

Description

@klausmyrseth

Installed flake through pipenv

$ pipenv install -d pytest
$ pipenv install -d flake8

Please provide the exact, unmodified output of flake8 --bug-report

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.9.5",
    "system": "Linux"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.8.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.4.0"
    }
  ],
  "version": "4.0.1"
}

Please describe the problem or feature
I have a project where flake aparently works as intended, and when I use the commandline flake it still works to some extent without all the pytest.ini setup, but within the Pipenv project it fails through pytest when it finds an error.
I run flake8:

$ python -m pytest --flake8

In all other projects we have it works flawlessly, and I really like the tool :D
In general the error comes when the file contains an error and flake8 tries to write to stdout.

This is my pipfile (removed the internal libs, but they dont wrap output in any way:

... removed private pypis ...

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest = {version="*", index="pypi"}
pytest-flake8 = {version="*", index="pypi"}
pylint = {version="*", index="pypi"}
strenum = {version="*", index="pypi"}
... private libs ...
google-cloud-datastore = {version="*", index="pypi"}
geojson = {version="*", index="pypi"}
firebase_admin = "*"

[packages]

[requires]
python_version = "3.9"

checked the locks, and same lib versions as bug-report and:
pytest 6.2.5
pytest-flake8 1.0.7

We have the same setup in other projects without the same issue so I'm a bit confused.
I however suspect something wrap the stdout StringIO so the expected attributes are not accessible by flake when it needs to report its findings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions