Hello! I’m running `pants fix ::` on my repositor...
# general
t
Hello! I’m running
pants fix ::
on my repository, and Black fails with the following error:
Copy code
ProcessExecutionFailure: Process 'Run Black on 2 files.' failed with exit code 123.
stdout:

stderr:
error: cannot format v1/main.py: cannot use --safe with this file; failed to parse source file AST: invalid syntax (<unknown>, line 17)
This could be caused by running Black with an older Python version that does not support new syntax used in your source file.

Oh no! 💥 💔 💥
1 file left unchanged, 1 file failed to reformat.
Relevant Config: • Pants version: 2.24.2 • Backends:
python
,
mypy
,
autoflake
,
black
,
isort
• Interpreter constraints: ◦ `python-default`: CPython 3.10.15 ◦ `v2`: CPython 3.11.11 • Resolves: ◦
python-default
→ 3.10.15 ◦
v2
→ 3.11.11 ◦
mypy
→ Separate resolve • Source roots:
/v1
,
/v2
I think black defaults to using python 3.8 or 3.9 which does not support
match
statements, which is where it is breaking. So I created a lockfile for black with just the black requirement and it is still failing. How can I make sure black runs with the proper python for the partition? Thanks!
Here are the logs for a debug run of pants fix
Here is a link to the repository: https://github.com/verdude/mypy-resolves
Interestingly enough, if I run
pants fix v1::
it works. I can also run
pants fix v2::
afterwards and it works.