From 38d6956c1f2e2b59b0fdf9b9c4748c96e1b0c258 Mon Sep 17 00:00:00 2001 From: Patrick Gerken Date: Fri, 14 Mar 2014 02:13:20 +0100 Subject: [PATCH] Properly catch import errors in apt When one accidentally tries to run this module as a user, he gets the error message that python-apt must be installed, no matter what. Because importing apt will trigger an exception as a regular user. Explicitly catching the ImportError will let the exception bubble. The exception clearly says Permission denied somewhere, and the user has a better idea, what he must fix. --- library/packaging/apt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/packaging/apt b/library/packaging/apt index 311bfa1199b..5e041c769bd 100644 --- a/library/packaging/apt +++ b/library/packaging/apt @@ -153,7 +153,7 @@ HAS_PYTHON_APT = True try: import apt import apt_pkg -except: +except ImportError: HAS_PYTHON_APT = False def package_split(pkgspec):