From ef77bd9cc237bd3ddae8e22fd325b412ad46ab00 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 17 Jan 2010 13:31:33 +0100 Subject: apt/progress/base.py: Use attributes of IOError and OSError object. Do not treat them as tuples, but use the attributes. This is way more 'modern'. --- apt/progress/base.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apt') diff --git a/apt/progress/base.py b/apt/progress/base.py index adb39e93..4df26f26 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -206,10 +206,10 @@ class InstallProgress(object): """Update the interface.""" try: line = self.statusfd.readline() - except IOError, (errno_, errstr): + except IOError, err: # resource temporarly unavailable is ignored - if errno_ != errno.EAGAIN and errno_ != errno.EWOULDBLOCK: - print errstr + if err.errno != errno.EAGAIN and err.errno != errno.EWOULDBLOCK: + print err.strerror return pkgname = status = status_str = percent = base = "" @@ -254,7 +254,7 @@ class InstallProgress(object): try: select.select([self.statusfd], [], [], self.select_timeout) except select.error, err: - if err[0] != errno.EINTR: + if err.errno != errno.EINTR: raise self.update_interface() @@ -263,9 +263,9 @@ class InstallProgress(object): if pid == self.child_pid: break except OSError, err: - if err[0] == errno.ECHILD: + if err.errno == errno.ECHILD: break - if err[0] != errno.EINTR: + if err.errno != errno.EINTR: raise return res -- cgit v1.2.3