# Buggy code
def __init__(
    self,
    *,
    argv: Iterable[str],
    description: str,
    additional_input_digest: Optional[Digest] = None,
    extra_env: Optional[Mapping[str, str]] = None,
    output_files: Optional[Iterable[str]] = None,
    output_directories: Optional[Iterable[str]] = None,
) -> None:
    self.argv = tuple(argv)
    self.description = description
    self.additional_input_digest = additional_input_digest
    self.extra_env = FrozenDict(extra_env) if extra_env else None
    self.output_files = tuple(output_files) if output_files else None
    self.output_directories = tuple(output_directories) if output_directories else None
    self.__post_init__()


# Traceback (pants.engine.internals.scheduler.ExecutionError)
$ ./pants fmt src/python/pants::
Compiling engine v0.0.1 (XXX)
Finished release [optimized + debuginfo] target(s) in 2m 49s
12:11:49 [INFO] initializing pantsd...
12:12:00 [INFO] pantsd initialized.
12:12:08.46 [INFO] Completed: Building black.pex with 2 requirements: black==19.10b0, setuptools
12:12:08 [WARN] /Users/tdyas/TC/pants/src/python/pants/base/exception_sink.py:359: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
process_title=setproctitle.getproctitle(),

12:12:08 [ERROR] 1 Exception encountered:

Engine traceback:
in select
in `fmt` goal
in pants.backend.python.lint.python_fmt.format_python_target
in Format with Black
in pants.engine.process.fallible_to_exec_result_or_raise
Traceback (most recent call last):
File "XXX/pants/src/python/pants/engine/process.py", line 229, in fallible_to_exec_result_or_raise
raise ProcessExecutionFailure(
pants.engine.process.ProcessExecutionFailure: Process 'Run Black on 413 files.' failed with exit code 127.
stdout:

stderr:
env: python3.7: No such file or directory

Traceback (most recent call last):
File "XXX/pants/src/python/pants/bin/local_pants_runner.py", line 255, in run
engine_result = self._run_v2()
File "XXX/pants/src/python/pants/bin/local_pants_runner.py", line 166, in _run_v2
return self._maybe_run_v2_body(goals, poll=False)
File "XXX/pants/src/python/pants/bin/local_pants_runner.py", line 183, in _maybe_run_v2_body
return self.graph_session.run_goal_rules(
File "XXX/pants/src/python/pants/init/engine_initializer.py", line 117, in run_goal_rules
exit_code = self.scheduler_session.run_goal_rule(
File "XXX/pants/src/python/pants/engine/internals/scheduler.py", line 552, in run_goal_rule
self._raise_on_error([t for _, t in throws])
File "XXX/pants/src/python/pants/engine/internals/scheduler.py", line 511, in _raise_on_error
raise ExecutionError(
pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered:

Engine traceback:
in select
in `fmt` goal
in pants.backend.python.lint.python_fmt.format_python_target
in Format with Black
in pants.engine.process.fallible_to_exec_result_or_raise
Traceback (most recent call last):
File "XXX/pants/src/python/pants/engine/process.py", line 229, in fallible_to_exec_result_or_raise
raise ProcessExecutionFailure(
pants.engine.process.ProcessExecutionFailure: Process 'Run Black on 413 files.' failed with exit code 127.
stdout:

stderr:
env: python3.7: No such file or directory

# Fixed code
def __init__(
    self,
    *,
    argv: Iterable[str],
    description: str,
    additional_input_digest: Optional[Digest] = None,
    extra_env: Optional[Mapping[str, str]] = None,
    output_files: Optional[Iterable[str]] = None,
    output_directories: Optional[Iterable[str]] = None,
    python: Optional[PythonExecutable] = None,
) -> None:
    self.argv = tuple(argv)
    self.description = description
    self.additional_input_digest = additional_input_digest
    self.extra_env = FrozenDict(extra_env) if extra_env else None
    self.output_files = tuple(output_files) if output_files else None
    self.output_directories = tuple(output_directories) if output_directories else None
    self.python = python
    self.__post_init__()