Fix exception indexing.
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index ae2b77f..3b21ff2 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -201,7 +201,7 @@
                 del fp, fd
                 return dir
             except (OSError, IOError) as e:
-                if e[0] != _errno.EEXIST:
+                if e.args[0] != _errno.EEXIST:
                     break # no point trying more names in this directory
                 pass
     raise IOError(_errno.ENOENT,