On Sun, 6 Dec 2020 16:31:18 -0500 Andres Salomon <dilin...@queued.net> wrote:
>
> --- /usr/share/dstat/dstat_squid.py.orig 2020-12-06 16:24:39.563332096 -0500
> +++ /usr/share/dstat/dstat_squid.py 2020-12-06 16:25:02.959555941 -0500
> @@ -45,7 +45,7 @@
>              if op.debug > 1: print('%s: lost pipe to squidclient, %s' % 
> (self.filename, e))
>              for name in self.vars: self.val[name] = -1
>          except Exception as e:
> -            if op.debug > 1: print('%s: exception' (self.filename, e))
> +            if op.debug > 1: print('%s: exception' % (self.filename, e))
>              for name in self.vars: self.val[name] = -1
>
>  # vim:ts=4:sw=4:et
> --- /usr/share/dstat/dstat_mysql_keys.py.orig 2020-12-06 16:24:48.231415192 
> -0500
> +++ /usr/share/dstat/dstat_mysql_keys.py 2020-12-06 16:25:22.959746212 -0500
> @@ -38,7 +38,7 @@
>              for name in self.vars: self.val[name] = -1
>
>          except Exception as e:
> -            if op.debug > 1: print('%s: exception' (self.filename, e))
> +            if op.debug > 1: print('%s: exception' % (self.filename, e))
>              for name in self.vars: self.val[name] = -1

These changes are not quite right. Adding the percent will work but
there is only one %s in the format string, so there should be only
one argument on the right-hand side of the percent. Possibly more
correct and useful is to change the print statement to

    print('%s: exception: %s' % (self.filename, e))

That will print out the exception message too, which would probably be
useful.

Reply via email to