From 999761130e910bb211c75467d66be7db7547e7fe Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 5 Jul 2018 15:37:33 +0800 Subject: [PATCH] Raise explicit exception for wrong which context --- pipenv/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipenv/core.py b/pipenv/core.py index 1a9bccce44..aaec1bf9fa 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -106,7 +106,8 @@ def which(command, location=None, allow_global=False): project.virtualenv_location or os.environ.get("VIRTUAL_ENV", "") ) - assert location and os.path.exists(location), "virtualenv not created" + if not location and os.path.exists(location): + raise RuntimeError("virtualenv not created nor specified") if not allow_global: if os.name == "nt": p = find_windows_executable(os.path.join(location, "Scripts"), command)