Reputation: 893
When I run risto.py
to generate a historical report (graph), I am getting the following error:
#risto.py --output history.png output.xml output1.xml
Traceback (most recent call last):
File "/usr/local/bin/risto.py", line 505, in <module>
Ristopy().main (sys.argv [1:])
File "/usr/local/bin/risto.py", line 428, in main
viewer_open = self.plot_one_graph (args)
File "/usr/local/bin/risto.py", line 442, in _plot_one_graph
output = self._plot (stats, opts)
File "/usr/local/bin/risto.py", line 455, in _plot
plotter = Plotter (opts['tag'], not opts['nocritical'],
KeyError: 'nocritical'
#risto.py --version
risto.py 1.0.2
I don't understand where I am going wrong.
Upvotes: 1
Views: 317
Reputation: 96
You have to modify and add the following functions to make the risto work:
def _plot_one_graph(self, args):
opts, paths = self._arg_parser.parse_args(args)
opts = self._handle_options(opts)
stats = AllStatistics(paths, opts['namemeta'], opts['verbose'])
output = self._plot(stats, opts)
return output is None
def _handle_options(self, opts):
if opts.get('critical') is None:
opts['critical'] = True
if opts.get('all') is None:
opts['all'] = True
if opts.get('totals') is None:
opts['totals'] = True
if opts.get('passed') is None:
opts['passed'] = True
if opts.get('failed') is None:
opts['failed'] = True
return opts
Please do a diff to get difference from your original file.
Upvotes: 2
Reputation: 96
First of all you are not doing any mistake. There is a bug in the risto.py code itself (line 461):
plotter = Plotter(opts['tag'], not opts['nocritical'],
not opts['noall'], not opts['nototals'],
not opts['nopassed'], not opts['nofailed'],
opts['width'], opts['height'], opts['font'],
opts['marker'], opts['xticks'])
replace it with the follwing:
plotter = Plotter(opts['tag'], opts['critical'],
opts['all'], opts['totals'],
opts['passed'], opts['failed'],
opts['width'], opts['height'], opts['font'],
opts['marker'], opts['xticks'])
Actually this is inside function def _plot(self, stats, opts): which is called by:
def _plot_one_graph(self, args):
opts, paths = self._arg_parser.parse_args(args)
stats = AllStatistics(paths, opts['namemeta'], opts['verbose'])
output = self._plot(stats, opts)
return output is None
If you print opts inside this function you will get the actual keys for the dictionary opts. After that I changed that above code snippet and now working fine.
Upvotes: 2