On Tue, 29 Aug 2017 11:14:47 +0200 Christian Schrötter wrote:
> > I think update-command-not-found should make it clearer that you need to
> > update the apt-cache prior to running it.
> Indeed, that would be great.
I was running into this problem just now, and after remembering how to
write Python 2 code, here is a small patch that should do the job :-)
--- /usr/sbin/update-command-not-found 2016-11-15 20:39:52.000000000 +0100
+++ debian/update-command-not-found 2018-03-11 21:01:32.084066383 +0100
@@ -69,7 +69,13 @@
- for fname in glob.glob('/var/lib/apt/lists/*Contents*.*'):
+ content_files = glob.glob('/var/lib/apt/lists/*Contents*.*')
+ if len(content_files) == 0:
+ print 'No files /var/lib/apt/lists/*Contents*.* found.'
+ print 'Please run "apt update" before using this command.'
+ for fname in content_files:
if "Contents-source" in fname: