summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2015-04-17 15:03:23 -0400
committerThomas Kluyver <takowl@gmail.com>2015-04-17 15:03:23 -0400
commitf4e858040a4c203bb1775a951b8c2e51a5a9ac47 (patch)
treec604e6fef81a3d40e72b9ad65a6ecbb132d60ce2
parent671417beb41c21f772687c565196fdde444b053b (diff)
parentaac5897aa12daf056b8fe08f1b6512d9f60c2d27 (diff)
downloadpexpect-git-3.x.tar.gz
Merge pull request #207 from Depado/fix_io_error_3.x3.x
Fix issue 126 for 3.x branch
-rw-r--r--pexpect/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py
index cace43b..acabf5a 100644
--- a/pexpect/__init__.py
+++ b/pexpect/__init__.py
@@ -490,7 +490,10 @@ class spawn(object):
# inherit EOF and INTR definitions from controlling process.
try:
from termios import VEOF, VINTR
- fd = sys.__stdin__.fileno()
+ try:
+ fd = sys.__stdin__.fileno()
+ except ValueError:
+ fd = sys.__stdout__.fileno()
self._INTR = ord(termios.tcgetattr(fd)[6][VINTR])
self._EOF = ord(termios.tcgetattr(fd)[6][VEOF])
except (ImportError, OSError, IOError, termios.error):