flake8
flake8 copied to clipboard
TypeError: argument of type 'NoneType' is not iterable
I can run linting locally using python -m flake8 --ignore E128,E302,E305,W292,BLK100 --max-line-length 120 --exclude .venv
command without showing up any errors, but my linting GitHub Action suddenly started failing with the following error. Everything was working as expected until a few days ago.
/opt/hostedtoolcache/Python/3.12.0/x64/bin/flake8 --ignore E128,E302,E305,W292,BLK100 --max-line-length 120 backend
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 83, in _mp_run
).run_checks()
^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 526, in run_checks
self.run_ast_checks()
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 428, in run_ast_checks
for line_number, offset, text, _ in runner:
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/bugbear.py", line 61, in run
if self.should_warn(e.message[:4]):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/bugbear.py", line 153, in should_warn
if code[:i] in self.options.select:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.0/x64/bin/flake8", line 8, in <module>
sys.exit(main())
^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/cli.py", line 23, in main
app.run(argv)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/application.py", line 198, in run
self._run(argv)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/application.py", line 187, in _run
self.run_checks()
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/application.py", line 103, in run_checks
self.file_checker_manager.run()
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 236, in run
self.run_parallel()
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 205, in run_parallel
self.results = list(pool.imap_unordered(_mp_run, self.filenames))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/multiprocessing/pool.py", line 873, in next
raise value
TypeError: argument of type 'NoneType' is not iterable
Error: The process '/opt/hostedtoolcache/Python/3.12.0/x64/bin/flake8' failed with exit code 1
Snippet of the workflow file:
- name: Flake8 linting
uses: py-actions/flake8@v2
with:
ignore: "E128,E302,E305,W292,BLK100"
max-line-length: 120
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
plugins: "flake8-bugbear==22.1.11 flake8-black"
Same exact error happening, I hope there's a fix soon
Following up as we are still facing the issue. Thank you.
Had similar issue, changing Python version to be <= 3.10 seems to work for me.