summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-09-17 13:17:45 -0700
committerThomas Kluyver <takowl@gmail.com>2013-09-17 13:17:45 -0700
commit7934cd86bf3c58ab3103b219f166826713d39b71 (patch)
tree6051584bed78e3ce614d493bd109602ae5e3afd8
parentc6a4203003818a17cd2b8af2eea13549a1210135 (diff)
downloadpexpect-7934cd86bf3c58ab3103b219f166826713d39b71.tar.gz
New style except statements
-rw-r--r--.gitignore1
-rw-r--r--pexpect.py14
2 files changed, 8 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 3341044..cbb858e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.pyc
doc/_build
+tests/log
diff --git a/pexpect.py b/pexpect.py
index 03f63d0..b4f02cb 100644
--- a/pexpect.py
+++ b/pexpect.py
@@ -80,7 +80,7 @@ try:
import errno
import traceback
import signal
-except ImportError, e:
+except ImportError as e:
raise ImportError(str(e) + '''
A critical module was not found. Probably this operating system does not
@@ -558,7 +558,7 @@ class spawn(object):
if self.use_native_pty_fork:
try:
self.pid, self.child_fd = pty.fork()
- except OSError, e:
+ except OSError as e:
raise ExceptionPexpect('pty.fork() failed: ' + str(e))
else:
# Use internal __fork_pty
@@ -1191,7 +1191,7 @@ class spawn(object):
try:
pid, status = os.waitpid(self.pid, waitpid_options)
- except OSError, e:
+ except OSError as e:
# No child processes
if e[0] == errno.ECHILD:
raise ExceptionPexpect('isalive() encountered condition ' +
@@ -1209,7 +1209,7 @@ class spawn(object):
try:
### os.WNOHANG) # Solaris!
pid, status = os.waitpid(self.pid, waitpid_options)
- except OSError, e:
+ except OSError as e:
# This should never happen...
if e[0] == errno.ECHILD:
raise ExceptionPexpect('isalive() encountered condition ' +
@@ -1464,7 +1464,7 @@ class spawn(object):
incoming = incoming + c
if timeout is not None:
timeout = end_time - time.time()
- except EOF, e:
+ except EOF as e:
self.buffer = ''
self.before = incoming
self.after = EOF
@@ -1477,7 +1477,7 @@ class spawn(object):
self.match = None
self.match_index = None
raise EOF(str(e) + '\n' + str(self))
- except TIMEOUT, e:
+ except TIMEOUT as e:
self.buffer = incoming
self.before = incoming
self.after = TIMEOUT
@@ -1637,7 +1637,7 @@ class spawn(object):
while True:
try:
return select.select(iwtd, owtd, ewtd, timeout)
- except select.error, e:
+ except select.error as e:
if e[0] == errno.EINTR:
# if we loop back we have to subtract the
# amount of time we already waited.