cool-easter-32542
04/01/2025, 5:37 AMpants run --debug-adapter path/to/some/file.py
2. clear the [GLOBAL].named_caches_dir cache (as one might do if they're using too much space)
3. pants run --debug-adapter path/to/some/file.py again, with no changes to code
In this case, the second invocation fails with an error like:
16:24:16.96 [INFO] Launching debug adapter at '127.0.0.1:5678', which will wait for a client connection...
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-ahVg0t/./src.pex/__main__.py", line 236, in <module>
result, should_exit, is_globals = boot(
^^^^^
File "/private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-ahVg0t/./src.pex/__main__.py", line 207, in boot
venv_dir = __maybe_run_venv__(
^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-ahVg0t/./src.pex/__main__.py", line 127, in __maybe_run_venv__
venv_root_dir = venv_dir(
^^^^^^^^^
File "/private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-ahVg0t/src.pex/.bootstrap/pex/variables.py", line 854, in venv_dir
File "/private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-ahVg0t/src.pex/.bootstrap/pex/variables.py", line 852, in add_pex_path_items
File "/private/var/folders/sv/vd266m4d4lvctgs2wpnhjs9w0000gn/T/pants-sandbox-ahVg0t/src.pex/.bootstrap/pex/pex_info.py", line 87, in from_pex
FileNotFoundError: [Errno 2] No such file or directory: 'debugpy.pex/PEX-INFO'
Reproducer:
cd $(mktemp -d)
local_store=$(mktemp -d)
named_caches=$(mktemp -d)
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.27.0.dev1"
backend_packages = ["pants.backend.python"]
local_store_dir = "$local_store"
named_caches_dir = "$named_caches"
[python]
interpreter_constraints = ["==3.10.*"]
EOF
echo "python_sources(name='src')" > BUILD
touch foo.py
# Start the scheduler
pants version
# First run:
pants run --debug-adapter ./foo.py &
# (wait for port to open, i.e. the debug adapter to start)
while ! nc -z localhost 5678; do sleep 0.5; done
# now kill the first run, which is just waiting on the debug adapter to connect
kill -INT %1
# clear the caches:
rm -rf "$named_caches"
# BUG: second run, fails with: No such file or directory: 'debugpy.pex/PEX-INFO'
pants run --debug-adapter ./foo.py
Pants version
2.27.0.dev1, likely many many more
OS
macOS
Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.
pantsbuild/pants