From 8db22799d64773b16a967da3c18d204f153e148c Mon Sep 17 00:00:00 2001 From: noah Date: Thu, 23 Aug 2012 21:58:52 +0000 Subject: Finished PEP8 modifications. git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@529 656d521f-e311-0410-88e0-e7920216d269 --- pexpect/pexpect.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py index 0896ef9..87151d3 100644 --- a/pexpect/pexpect.py +++ b/pexpect/pexpect.py @@ -622,11 +622,11 @@ class spawn(object): parent_fd, child_fd = os.openpty() if parent_fd < 0 or child_fd < 0: - raise ExceptionPexpect, "Could not open with os.openpty()." + raise ExceptionPexpect("Could not open with os.openpty().") pid = os.fork() if pid < 0: - raise ExceptionPexpect, "Failed os.fork()." + raise ExceptionPexpect("Failed os.fork().") elif pid == 0: # Child. os.close(parent_fd) @@ -669,8 +669,8 @@ class spawn(object): fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY) if fd >= 0: os.close(fd) - raise ExceptionPexpect, 'Failed to disconnect from ' + \ - 'controlling tty. It is still possible to open /dev/tty.' + raise ExceptionPexpect('Failed to disconnect from ' + + 'controlling tty. It is still possible to open /dev/tty.') except: # Good! We are disconnected from a controlling tty. pass @@ -678,14 +678,14 @@ class spawn(object): # Verify we can open child pty. fd = os.open(child_name, os.O_RDWR) if fd < 0: - raise ExceptionPexpect, "Could not open child pty, " + child_name + raise ExceptionPexpect("Could not open child pty, " + child_name) else: os.close(fd) # Verify we now have a controlling tty. fd = os.open("/dev/tty", os.O_WRONLY) if fd < 0: - raise ExceptionPexpect, "Could not open controlling tty, /dev/tty" + raise ExceptionPexpect("Could not open controlling tty, /dev/tty") else: os.close(fd) @@ -1878,7 +1878,8 @@ def which(filename): if os.access(filename, os.X_OK): return filename - if not os.environ.has_key('PATH') or os.environ['PATH'] == '': + #if not os.environ.has_key('PATH') or os.environ['PATH'] == '': + if not 'PATH' in os.environ or os.environ['PATH'] == '': p = os.defpath else: p = os.environ['PATH'] -- cgit v1.2.1