Mercurial > hg
diff hgext/inotify/client.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 | 08a0f04b56bd |
children | 0c23085f051f |
line wrap: on
line diff
--- a/hgext/inotify/client.py Wed Jul 14 22:59:57 2010 -0300 +++ b/hgext/inotify/client.py Wed Jul 14 23:03:21 2010 -0300 @@ -27,11 +27,11 @@ except (OSError, socket.error), err: autostart = self.ui.configbool('inotify', 'autostart', True) - if err[0] == errno.ECONNREFUSED: + if err.args[0] == errno.ECONNREFUSED: self.ui.warn(_('inotify-client: found dead inotify server ' 'socket; removing it\n')) os.unlink(os.path.join(self.root, '.hg', 'inotify.sock')) - if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart: + if err.args[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart: self.ui.debug('(starting inotify server)\n') try: try: @@ -49,13 +49,13 @@ return function(self, *args) except socket.error, err: self.ui.warn(_('inotify-client: could not talk to new ' - 'inotify server: %s\n') % err[-1]) - elif err[0] in (errno.ECONNREFUSED, errno.ENOENT): + 'inotify server: %s\n') % err.args[-1]) + elif err.args[0] in (errno.ECONNREFUSED, errno.ENOENT): # silently ignore normal errors if autostart is False self.ui.debug('(inotify server not running)\n') else: self.ui.warn(_('inotify-client: failed to contact inotify ' - 'server: %s\n') % err[-1]) + 'server: %s\n') % err.args[-1]) self.ui.traceback() raise QueryFailed('inotify query failed') @@ -75,7 +75,7 @@ try: self.sock.connect(sockpath) except socket.error, err: - if err[0] == "AF_UNIX path too long": + if err.args[0] == "AF_UNIX path too long": sockpath = os.readlink(sockpath) self.sock.connect(sockpath) else: