Fix stale wrapper scripts after migrating from loose scripts to package entry points, especially when PATH and duplicate wrapper directories cause the wrong command to run.
When migrating from loose scripts to a proper Python package with [project.scripts] entry points, stale wrapper scripts can keep launching the old code even when the new package is installed and healthy.
Identify what binary is actually running:
which <command>
type -a <command>
Check PATH order:
printf '%s\n' "$PATH" | tr ':' '\n'
Check both the normal shell and an interactive bash if needed. A command may resolve differently inside a project venv versus the user's normal shell.
Inspect all wrapper locations, not just one:
ls -la ~/.hermes/bin ~/bin 2>/dev/null
cat ~/.hermes/bin/<command>
cat ~/bin/<command>
Duplicate wrappers in ~/.hermes/bin/ and ~/bin/ are a classic source of 'wrong script is running' bugs.
Verify the new binary works directly:
~/.hermes/projects/<project>/.venv/bin/<command> --help
If there is a paired host/client setup, inspect both sides. Fixing teleop while leaving the old host wrapper in place is how you lose another hour.
Update the canonical wrapper to exec the new entry point directly:
#!/bin/bash
NEW_PROJECT_DIR="$HOME/.hermes/projects/<new-project>"
VENV_PATH="$NEW_PROJECT_DIR/.venv"
exec "$VENV_PATH/bin/<command>" "$@"
Do not source the venv and call python old_script.py unless you intentionally want the old script path.
If the user wants ~/.hermes/bin to be the canonical wrapper directory, add it to ~/.bashrc and avoid duplicate-path sludge:
. "$HOME/.local/bin/env"
case ":$PATH:" in
*":$HOME/.hermes/bin:"*) ;;
*) export PATH="$HOME/.hermes/bin:$PATH" ;;
esac
Then either remove or repoint duplicate wrappers in ~/bin.
source a venv then call python script.py won't use package entry points~/.hermes/bin/ and ~/bin/ can make one shell use the new code and another shell use the old code~/.hermes/bin may exist but not actually be on PATHwhich <command>
type -a <command>
<command> --help
For shell startup changes, open a fresh interactive bash and re-check PATH order before declaring victory.