From 6da51149225807ab19e7f7278054d0fcd4e45b45 Mon Sep 17 00:00:00 2001 From: notEvil Date: Wed, 11 Oct 2023 09:21:24 +0200 Subject: [PATCH] Fixes #5969 by adding and using argument bare to function do_py --- pipenv/cli/command.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index fb4ee058..a61b9a64 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -27,6 +27,7 @@ from pipenv.utils.processes import subprocess_run from pipenv.vendor.click import ( Choice, argument, + echo, edit, group, option, @@ -125,7 +126,7 @@ def cli( do_where(state.project, bare=True) return 0 elif py: - do_py(state.project, ctx=ctx) + do_py(state.project, ctx=ctx, bare=True) return 0 # --support was passed... elif support: @@ -758,7 +759,7 @@ if __name__ == "__main__": cli() -def do_py(project, ctx=None, system=False): +def do_py(project, ctx=None, system=False, bare=False): if not project.virtualenv_exists: err.print( "[red]No virtualenv has been created for this project[/red] " @@ -768,6 +769,7 @@ def do_py(project, ctx=None, system=False): ctx.abort() try: - console.print(project._which("python", allow_global=system)) + (echo if bare else console.print)(project._which("python", allow_global=system)) except AttributeError: console.print("No project found!", style="red") + ctx.abort()