Closed Minipada closed 2 years ago
I think the error is triggered because some other extension interfers...If i remove darglint
or flake8-variables-names
in the the precommit configuration, this is not displayed anymore... I'm a bit lost on this one
Unfortunately I can't immediately reproduce this on my default macOS setup:
$ flake8 --version
4.0.1 (black: 0.3.3, flake8-darglint: 1.8.1, flake8-variables-names: 0.0.5, mccabe: 0.6.1, pycodestyle:
2.8.0, pyflakes: 2.4.0) CPython 3.9.13 on Darwin
Using the GitHub code search, "PY310" does not seem to in the code of https://github.com/terrencepreilly/darglint/ or https://github.com/best-doctor/flake8-variables-names/ as a plain string.
Unfortunately "PY310" is effectively the output of str(exception)
rather than repr(exception)
, so we don't immediately know what the class is - which may help with tracking down where the exception comes from.
I suggest you try this change in the hope of getting a clue:
$ git diff
diff --git a/flake8_black.py b/flake8_black.py
index aaf762c..309f06b 100644
--- a/flake8_black.py
+++ b/flake8_black.py
@@ -223,7 +223,7 @@ class BlackStyleChecker:
except BadBlackConfig as err:
msg = "997 Invalid TOML file: %s" % err
except Exception as err:
- msg = "999 Unexpected exception: %s" % err
+ msg = "999 Unexpected exception: %r" % err
else:
assert (
new_code != source
You might also try changing that line to raise err
in the hope of getting a traceback when run via flake8?
Before trying to edit the flake8_black.py, I cleaned up my pre-commit cache directory. After that, the error disappeared. I can't reproduce it at all now. I will close the issue and if it comes back, I or other users could reproduce it.
Curious - hopefully it won't come back. Thanks for the update.
Setup
pyproject.toml contains:
python 3.8.10 flake8-black version: 0.3.3 poetry version: 1.1.13
pre-commit:
What I did
running:
works
As does
poetry run flake8 ...
But
and
returns
Only this extension gives problems on pre-commit, not sure why: