diff hgext/inotify/server.py @ 11567:34cc8b84407f

removed exception args indexing (not supported by py3k) Py3k removed __getitem__ for exception classes. The correct way of getting the exception arguments is by using the args method.
author Renato Cunha <renatoc@gmail.com>
date Wed, 14 Jul 2010 23:03:21 -0300
parents db9d16233787
children 2d3cbcace897
line wrap: on
line diff
--- a/hgext/inotify/server.py	Wed Jul 14 22:59:57 2010 -0300
+++ b/hgext/inotify/server.py	Wed Jul 14 23:03:21 2010 -0300
@@ -336,10 +336,10 @@
         try:
             self.sock.bind(self.sockpath)
         except socket.error, err:
-            if err[0] == errno.EADDRINUSE:
+            if err.args[0] == errno.EADDRINUSE:
                 raise AlreadyStartedException(_('cannot start: socket is '
                                                 'already bound'))
-            if err[0] == "AF_UNIX path too long":
+            if err.args[0] == "AF_UNIX path too long":
                 if os.path.islink(self.sockpath) and \
                         not os.path.exists(self.sockpath):
                     raise util.Abort('inotify-server: cannot start: '
@@ -437,7 +437,7 @@
             finally:
                 sock.shutdown(socket.SHUT_WR)
         except socket.error, err:
-            if err[0] != errno.EPIPE:
+            if err.args[0] != errno.EPIPE:
                 raise
 
 if sys.platform == 'linux2':