# Buggy code
def __init__(
    self,
    *,
    output_filename: str,
    internal_only: bool,
    requirements: PexRequirements = PexRequirements(),
    interpreter_constraints=PexInterpreterConstraints(),
    platforms=PexPlatforms(),
    sources: Optional[Digest] = None,
    additional_inputs: Optional[Digest] = None,
    entry_point: Optional[str] = None,
    additional_args: Iterable[str] = (),
    description: Optional[str] = None,
) -> None:
    """A request to create a PEX from its inputs.

    :param output_filename: The name of the built Pex file, which typically should end in
        `.pex`.
    :param internal_only: Whether we ever materialize the Pex and distribute it directly
        to end users, such as with the `binary` goal. Typically, instead, the user never
        directly uses the Pex, e.g. with `lint` and `test`. If True, we will use a Pex setting
        that results in faster build time but compatibility with fewer interpreters at runtime.
    :param requirements: The requirements to install.
    :param interpreter_constraints: Any constraints on which Python versions may be used.
    :param platforms: Which platforms should be supported. Setting this value will cause
        interpreter constraints to not be used because platforms already constrain the valid
        Python versions, e.g. by including `cp36m` in the platform string.
    :param sources: Any source files that should be included in the Pex.
    :param additional_inputs: Any inputs that are not source files and should not be included
        directly in the Pex, but should be present in the environment when building the Pex.
    :param entry_point: The entry-point for the built Pex, equivalent to Pex's `-m` flag. If
        left off, the Pex will open up as a REPL.
    :param additional_args: Any additional Pex flags.
    :param description: A human-readable description to render in the dynamic UI when building
        the Pex.
    """
    self.output_filename = output_filename
    self.internal_only = internal_only
    self.requirements = requirements
    self.interpreter_constraints = interpreter_constraints
    self.platforms = platforms
    self.sources = sources
    self.additional_inputs = additional_inputs
    self.entry_point = entry_point
    self.additional_args = tuple(additional_args)
    self.description = description


# 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,
    *,
    output_filename: str,
    internal_only: bool,
    requirements: PexRequirements = PexRequirements(),
    interpreter_constraints=PexInterpreterConstraints(),
    platforms=PexPlatforms(),
    sources: Optional[Digest] = None,
    additional_inputs: Optional[Digest] = None,
    entry_point: Optional[str] = None,
    additional_args: Iterable[str] = (),
    description: Optional[str] = None,
) -> None:
    """A request to create a PEX from its inputs.

    :param output_filename: The name of the built Pex file, which typically should end in
        `.pex`.
    :param internal_only: Whether we ever materialize the Pex and distribute it directly
        to end users, such as with the `binary` goal. Typically, instead, the user never
        directly uses the Pex, e.g. with `lint` and `test`. If True, we will use a Pex setting
        that results in faster build time but compatibility with fewer interpreters at runtime.
    :param requirements: The requirements to install.
    :param interpreter_constraints: Any constraints on which Python versions may be used.
    :param platforms: Which platforms should be supported. Setting this value will cause
        interpreter constraints to not be used because platforms already constrain the valid
        Python versions, e.g. by including `cp36m` in the platform string.
    :param sources: Any source files that should be included in the Pex.
    :param additional_inputs: Any inputs that are not source files and should not be included
        directly in the Pex, but should be present in the environment when building the Pex.
    :param entry_point: The entry-point for the built Pex, equivalent to Pex's `-m` flag. If
        left off, the Pex will open up as a REPL.
    :param additional_args: Any additional Pex flags.
    :param description: A human-readable description to render in the dynamic UI when building
        the Pex.
    """
    self.output_filename = output_filename
    self.internal_only = internal_only
    self.requirements = requirements
    self.interpreter_constraints = interpreter_constraints
    self.platforms = platforms
    self.sources = sources
    self.additional_inputs = additional_inputs
    self.entry_point = entry_point
    self.additional_args = tuple(additional_args)
    self.description = description
    self.__post_init__()