Control: reassign -1 python-apt Control: retitle -1 python-apt issues a warning when /etc/apt/sources.list does not exist Control: tag -1 + patch
On Sat, Feb 23, 2019 at 08:38:45PM +0100, Nicolas Braud-Santoni wrote: > On my system, /etc/apt/sources.list does not exist (I exclusively use > sources.list.d), causing command-not-found to issue a warning on every run: > > > $ command-not-found cowsay > > WARNING:root:could not open file '/etc/apt/sources.list' > > > > Command 'cowsay' is available in '/usr/games/cowsay' > > cowsay: command not found Dear maintainers, I finally took the time to investigate this issue, and discovered it was caused by python-apt unconditionally trying to open /etc/apt/sources.list. Please find attached a patch, also sent as a MR on Salsa: https://salsa.debian.org/apt-team/python-apt/merge_requests/18 Best, nicoo
From faa7243a3e4d358f291bdfa869d0410ebd11cdd0 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni <ni...@debian.org> Date: Fri, 18 Oct 2019 19:34:14 +0200 Subject: [PATCH] aptsources.sourceslist.SourcesList.load: Ignore FileNotFoundError Closes: 923071 --- aptsources/sourceslist.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 22649984..76c73f5d 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -389,6 +389,8 @@ class SourcesList(object): for line in f: source = SourceEntry(line, file) self.list.append(source) + except FileNotFoundError: + pass except Exception: logging.warning("could not open file '%s'\n" % file) -- 2.23.0
signature.asc
Description: PGP signature