Skip to content

Commit 17e145c

Browse files
committed
if uuid is not available, use random to generate a name for the new environment
1 parent e34bd36 commit 17e145c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

virtualenvwrapper.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,12 @@ mktmpenv() {
916916
# Generate a unique temporary name, if one is not given.
917917
if [ $# -eq 0 ]
918918
then
919-
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid; print uuid.uuid4()')
919+
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import uuid; print uuid.uuid4()' 2>/dev/null)
920+
if [ -z "$tmpenvname" ]
921+
then
922+
# This python does not support uuid
923+
tmpenvname=$("$VIRTUALENVWRAPPER_PYTHON" -c 'import random; print hex(random.getrandbits(64))[2:-1]' 2>/dev/null)
924+
fi
920925
mkvirtualenv "$tmpenvname"
921926
else
922927
mkvirtualenv "$@"

0 commit comments

Comments
 (0)