flake8-plugin-utils icon indicating copy to clipboard operation
flake8-plugin-utils copied to clipboard

AttributeError: 'StringsPlugin' object has no attribute '_lines'

Open enrh opened this issue 5 years ago • 2 comments

  • Date you used flake8-plugin-utils: 06/01/2021
  • flake8-plugin-utils version used, if any: 1.3.2
  • Python version, if any: 3.9.1
  • Operating System: Fedora Linux

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

Running standard checks on my code.

What I Did

$ venv/bin/flake8 sapy
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "venv/lib/python3.9/site-packages/flake8/checker.py", line 676, in _run_checks
    return checker.run_checks()
  File "venv/lib/python3.9/site-packages/flake8_noqa/noqa_filter.py", line 174, in run_checks
    result = super().run_checks(*args, **kwargs)
  File "venv/lib/python3.9/site-packages/flake8/checker.py", line 589, in run_checks
    self.run_ast_checks()
  File "venv/lib/python3.9/site-packages/flake8/checker.py", line 494, in run_ast_checks
    for (line_number, offset, text, _) in runner:
  File "venv/lib/python3.9/site-packages/flake8_plugin_utils/plugin.py", line 70, in run
    visitor = self._create_visitor(visitor_cls)
  File "venv/lib/python3.9/site-packages/flake8_strings/plugin.py", line 16, in _create_visitor
    visitor.lines = self._lines
AttributeError: 'StringsPlugin' object has no attribute '_lines'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "venv/lib/python3.9/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "venv/lib/python3.9/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "venv/lib/python3.9/site-packages/flake8/main/application.py", line 351, in _run
    self.run_checks()
  File "venv/lib/python3.9/site-packages/flake8/main/application.py", line 264, in run_checks
    self.file_checker_manager.run()
  File "venv/lib/python3.9/site-packages/flake8/checker.py", line 321, in run
    self.run_parallel()
  File "venv/lib/python3.9/site-packages/flake8/checker.py", line 287, in run_parallel
    for ret in pool_map:
  File "pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 448, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "pyenv/versions/3.9.1/lib/python3.9/multiprocessing/pool.py", line 870, in next
    raise value
AttributeError: 'StringsPlugin' object has no attribute '_lines'

enrh avatar Jun 01 '21 11:06 enrh

This does not occur with version 1.3.1

enrh avatar Jun 01 '21 12:06 enrh

flake8_strings plugin uses a private attribute of the visitor class that was removed in the latest patch version, ask the plugin author to fix this.

afonasev avatar Jun 07 '21 11:06 afonasev