Skip to content

Commit af7e3de

Browse files
committed
move error reporting for bad python interpreter closer to where the error occurs
1 parent d122947 commit af7e3de

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

virtualenvwrapper.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,16 @@ function virtualenvwrapper_run_hook {
177177
fi
178178
# cat "$hook_script"
179179
source "$hook_script"
180+
elif [ "${1}" = "initialize" ]
181+
then
182+
cat - 1>&2 <<EOF
183+
virtualenvwrapper.sh: There was a problem running the initialization hooks.
184+
185+
If Python could not import the module virtualenvwrapper.hook_loader,
186+
check that virtualenv has been installed for
187+
VIRTUALENVWRAPPER_PYTHON=$VIRTUALENVWRAPPER_PYTHON and that PATH is
188+
set properly.
189+
EOF
180190
fi
181191
\rm -f "$hook_script"
182192
return $result
@@ -239,11 +249,6 @@ function virtualenvwrapper_initialize {
239249
fi
240250

241251
virtualenvwrapper_run_hook "initialize"
242-
if [ $? -ne 0 ]
243-
then
244-
echo "virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON=$VIRTUALENVWRAPPER_PYTHON and that PATH is set properly." 1>&2
245-
return 1
246-
fi
247252

248253
virtualenvwrapper_setup_tab_completion
249254

@@ -994,6 +999,6 @@ EOF
994999

9951000

9961001
#
997-
# Invoke the initialization hooks
1002+
# Invoke the initialization functions
9981003
#
9991004
virtualenvwrapper_initialize

0 commit comments

Comments
 (0)