venvlib: handle missing log file better

If we failed early enough that there is no log, don't crash trying
to dump it.

TEST=create_env w/missing py2 modules doesn't double crash

Change-Id: Ic0174e4e83dca686e7eccfecc4db3a28bb3745d2
Reviewed-by: Chris McDonald <>
Commit-Queue: Mike Frysinger <>
Tested-by: Mike Frysinger <>
diff --git a/venv/cros_venv/ b/venv/cros_venv/
index f55c6f2..cda555f 100644
--- a/venv/cros_venv/
+++ b/venv/cros_venv/
@@ -116,8 +116,13 @@
     def logdata(self):
         """Get any internal logged data."""
-        with open(self._paths.logfile) as fp:
-            return
+        try:
+            with open(self._paths.logfile) as fp:
+                return
+        except IOError as e:
+            if e.errno == errno.ENOENT:
+                return '<log does not exist>'
+            raise
     def _log_env(self, logfile):
         """Log details about the active runtime for debugging."""