blob: 42e6767b5f505c7215054df826061a1238b40426 [file]
%shebang%import sys
# See @rules_python//crates/py_console_script_gen for explanation
if getattr(sys.flags, "safe_path", False):
# We are running on Python 3.11 and we don't need this workaround
pass
elif ".runfiles" not in sys.path[0]:
sys.path = sys.path[1:]
try:
from %module% import %attr%
except ImportError:
entries = "\n".join(sys.path)
print("Printing sys.path entries for easier debugging:", file=sys.stderr)
print(f"sys.path is:\n{entries}", file=sys.stderr)
raise
if __name__ == "__main__":
sys.exit(%entry_point%()) # pyrefly: ignore[not-callable]