Jason R. Coombs avatar Jason R. Coombs committed 0b59887

Fixed several more syntax errors on Python 2.3. The module no compiles under Python 2.3.

Comments (0)

Files changed (1)

cherrypy/_cpcompat_subprocess.py

     while True:
         try:
             return func(*args)
-        except (OSError, IOError) as e:
+        except (OSError, IOError), e:
             if e.errno == errno.EINTR:
                 continue
             raise
                 if input:
                     try:
                         self.stdin.write(input)
-                    except IOError as e:
+                    except IOError, e:
                         if e.errno != errno.EPIPE and e.errno != errno.EINVAL:
                             raise
                 self.stdin.close()
 
             # Start the process
             try:
-                hp, ht, pid, tid = _subprocess.CreateProcess(executable, args,
+                try:
+                    hp, ht, pid, tid = _subprocess.CreateProcess(executable, args,
                                          # no special security
                                          None, None,
                                          int(not close_fds),
                                          env,
                                          cwd,
                                          startupinfo)
-            except pywintypes.error, e:
-                # Translate pywintypes.error to WindowsError, which is
-                # a subclass of OSError.  FIXME: We should really
-                # translate errno using _sys_errlist (or similar), but
-                # how can this be done from Python?
-                raise WindowsError(*e.args)
+                except pywintypes.error, e:
+                    # Translate pywintypes.error to WindowsError, which is
+                    # a subclass of OSError.  FIXME: We should really
+                    # translate errno using _sys_errlist (or similar), but
+                    # how can this be done from Python?
+                    raise WindowsError(*e.args)
             finally:
                 # Child is launched. Close the parent's copy of those pipe
                 # handles that only the child should have open.  You need
                 if input is not None:
                     try:
                         self.stdin.write(input)
-                    except IOError as e:
+                    except IOError, e:
                         if e.errno != errno.EPIPE:
                             raise
                 self.stdin.close()
 
                             # Close pipe fds.  Make sure we don't close the
                             # same fd more than once, or standard fds.
-                            closed = { None }
+                            closed = set([None])
                             for fd in [p2cread, c2pwrite, errwrite]:
                                 if fd not in closed and fd > 2:
                                     os.close(fd)
             if data != "":
                 try:
                     _eintr_retry_call(os.waitpid, self.pid, 0)
-                except OSError as e:
+                except OSError, e:
                     if e.errno != errno.ECHILD:
                         raise
                 child_exception = pickle.loads(data)
             if self.returncode is None:
                 try:
                     pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
-                except OSError as e:
+                except OSError, e:
                     if e.errno != errno.ECHILD:
                         raise
                     # This happens if SIGCLD is set to be ignored or waiting
                         chunk = input[input_offset : input_offset + _PIPE_BUF]
                         try:
                             input_offset += os.write(fd, chunk)
-                        except OSError as e:
+                        except OSError, e:
                             if e.errno == errno.EPIPE:
                                 close_unregister_and_remove(fd)
                             else:
                     chunk = input[input_offset : input_offset + _PIPE_BUF]
                     try:
                         bytes_written = os.write(self.stdin.fileno(), chunk)
-                    except OSError as e:
+                    except OSError, e:
                         if e.errno == errno.EPIPE:
                             self.stdin.close()
                             write_set.remove(self.stdin)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.