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

[Error] Not working with flake8==7.0.0 and Python 3.11.7 #191

Open
Danipulok opened this issue Jan 23, 2024 · 0 comments
Open

[Error] Not working with flake8==7.0.0 and Python 3.11.7 #191

Danipulok opened this issue Jan 23, 2024 · 0 comments

Comments

@Danipulok
Copy link

Installed versions:

flake8==7.0.0
flake8-simplify==0.21.0

Error:

$ flake8
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8\checker.py", line 83, in _mp_run
    ).run_checks()
      ^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8\checker.py", line 526, in run_checks
    self.run_ast_checks()
  File "D:\app\.venv11\Lib\site-packages\flake8\checker.py", line 428, in run_ast_checks
    for line_number, offset, text, _ in runner:
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\__init__.py", line 161, in run
    visitor.visit(self._tree)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\ast.py", line 426, in generic_visit
    self.visit(item)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\__init__.py", line 146, in visit_ClassDef
    self.generic_visit(node)
  File "C:\Program Files\Python311\Lib\ast.py", line 426, in generic_visit
    self.visit(item)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\ast.py", line 426, in generic_visit
    self.visit(item)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\__init__.py", line 89, in visit_Expr
    self.generic_visit(node)
  File "C:\Program Files\Python311\Lib\ast.py", line 428, in generic_visit
    self.visit(value)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\__init__.py", line 81, in visit_Call
    self.generic_visit(node)
  File "C:\Program Files\Python311\Lib\ast.py", line 426, in generic_visit
    self.visit(item)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\__init__.py", line 81, in visit_Call
    self.generic_visit(node)
  File "C:\Program Files\Python311\Lib\ast.py", line 426, in generic_visit
    self.visit(item)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\ast.py", line 428, in generic_visit
    self.visit(value)
  File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\__init__.py", line 77, in visit_Call
    self.errors += get_sim905(node)
                   ^^^^^^^^^^^^^^^^
  File "D:\app\.venv11\Lib\site-packages\flake8_simplify\rules\ast_call.py", line 111, in get_sim905
    expected = json.dumps(value.split())
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
"""
 
The above exception was the direct cause of the following exception:
 
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\app\.venv11\Scripts\flake8.exe\__main__.py", line 7, in <module>
  File "D:\app\.venv11\Lib\site-packages\flake8\main\cli.py", line 23, in main
    app.run(argv)
  File "D:\app\.venv11\Lib\site-packages\flake8\main\application.py", line 198, in run
    self._run(argv)
  File "D:\app\.venv11\Lib\site-packages\flake8\main\application.py", line 187, in _run
    self.run_checks()
  File "D:\app\.venv11\Lib\site-packages\flake8\main\application.py", line 103, in run_checks
    self.file_checker_manager.run()
  File "D:\app\.venv11\Lib\site-packages\flake8\checker.py", line 236, in run
    self.run_parallel()
  File "D:\app\.venv11\Lib\site-packages\flake8\checker.py", line 205, in run_parallel
    self.results = list(pool.imap_unordered(_mp_run, self.filenames))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\multiprocessing\pool.py", line 873, in next
    raise value
TypeError: Object of type bytes is not JSON serializable

OS info:

OS: Windows
OS Release: 10
OS Version: 10.0.19045
Architecture: AMD64
Processor: AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD
Python Version: 3.11.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant