From da05e971313ef0931a5d05af022f4f0d6a35dd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vask=C3=B3=20L=C3=A1szl=C3=B3?= Date: Sat, 15 Jul 2017 16:18:13 +0200 Subject: [PATCH] session: report more meaningful errors on why virtualenv creation failed virtualenv fails if the destination directory contains unicode characters or spaces. A more descriptive error is printed if it's likely that that was the case. I didn't precheck the directory path for not supported characters because if this problem is fixed by upstream we wouldn't want execution to fail. --- tox/session.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tox/session.py b/tox/session.py index fd726ac50..71eeb4124 100644 --- a/tox/session.py +++ b/tox/session.py @@ -449,8 +449,19 @@ def setupenv(self, venv): envlog = self.resultlog.get_envlog(venv.name) try: status = venv.update(action=action) - except tox.exception.InvocationError: - status = sys.exc_info()[1] + except FileNotFoundError as e: + status = ( + "Error creating virtualenv. " + "Note that spaces in path are not supported by virtualenv. " + "Error details: %r" % e + ) + except tox.exception.InvocationError as e: + status = ( + "Error creating virtualenv. " + "Note that some special characters (such as ':' and unicode symbols) " + "in path are not supported by virtualenv. " + "Error details: %r" % e + ) if status: commandlog = envlog.get_commandlog("setup") commandlog.add_command(["setup virtualenv"], str(status), 1)