# Buggy code
def wait(self):
    # type: () -> None
    """Waits for the job to complete.

    :raises: :class:`Job.Error` if the job exited non-zero.
    """
    self._process.wait()
    self._check_returncode()


# Traceback (pex.jobs.Error)
$ python3.8 -mvenv venv
$ venv/bin/pip -q install -U pip
$ venv/bin/pip -q install pex
$ venv/bin/pex --version
2.1.30
$ venv/bin/pip -q install --target dir pex==2.1.16
$ ls dir/
bin  pex  pex-2.1.16.dist-info
$ venv/bin/pex isort -c isort -o dir/isort.pex
$ cd dir/
dir $ rm -rf ~/.pex/interpreters/
dir $ ./isort.pex


_                 _
(_) ___  ___  _ __| |_
| |/ _/ / _ \/ '__  _/
| |\__ \/\_\/| |  | |_
|_|\___/\___/\_/   \_/

isort your imports, so you don't have to.

VERSION 5.7.0


Nothing to do: no files or paths have have been passed in!

Try one of the following:

`isort .` - sort all Python files, starting from the current directory, recursively.
`isort . --interactive` - Do the same, but ask before making any changes.
`isort . --check --diff` - Check to see if imports are correctly sorted within this project.
`isort --help` - In-depth information about isort's available command-line options.

Visit https://pycqa.github.io/isort/ for complete information about how to use isort.

dir $ rm -rf ~/.pex/interpreters/
dir $ source ../venv/bin/activate
(venv) dir $ ./isort.pex
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "./isort.pex/__main__.py", line 81, in <module>
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/pex_bootstrapper.py", line 403, in bootstrap_pex
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/pex_bootstrapper.py", line 305, in maybe_reexec_pex
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/interpreter.py", line 922, in resolve_base_interpreter
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/interpreter.py", line 710, in from_binary
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/jobs.py", line 199, in await_result
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/jobs.py", line 78, in communicate
File "/tmp/pex_ii_leak/dir/isort.pex/.bootstrap/pex/jobs.py", line 103, in _check_returncode
pex.jobs.Error: Executing /usr/bin/python3.8 -s -c import os
import sys

from pex.common import atomic_directory, safe_open
from pex.interpreter import PythonIdentity


encoded_identity = PythonIdentity.get(binary='/usr/bin/python3.8').encode()
sys.stdout.write(encoded_identity)
with atomic_directory('/home/jsirois/.pex/interpreters/f841ccf354cda73fa22fdf414a02f6c680c1b032/a65b2009934de8713e1f759d0553218a35dd5bfe/e90219f1da0abbc0e93646d91bc21868bc95a74d', exclusive=False) as cache_dir:
if cache_dir:
with safe_open(os.path.join(cache_dir, 'INTERP-INFO'), 'w') as fp:
fp.write(encoded_identity)
failed with 1
STDERR:
Traceback (most recent call last):
File "<string>", line 8, in <module>
TypeError: get() got an unexpected keyword argument 'binary'

# Fixed code
def wait(self):
    # type: () -> None
    """Waits for the job to complete.

    :raises: :class:`Job.Error` if the job exited non-zero.
    """
    try:
        self._process.wait()
        self._check_returncode()
    finally:
        self._finalize_job()