arthurdejong/munin-plot

Python version 2.7 or 3.5

Closed this issue · 3 comments

I just try to install this soft and I havec stack exceptions I can not solve.
in Python2.7 :

 mod_wsgi (pid=2774): Exception occurred processing WSGI script '/usr/share/munin-plot/web.py'. 
 Traceback (most recent call last):
   File "/usr/share/munin-plot/web.py", line 115, in application
     return list_graphs(environ, start_response)
   File "/usr/share/munin-plot/web.py", line 50, in list_graphs
     return [json.dumps(get_info(), indent=2, sort_keys=True).encode('utf-8')]
   File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
     sort_keys=sort_keys, **kw).encode(obj)
   File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
     chunks = list(chunks)
   File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
     for chunk in _iterencode_dict(o, _current_indent_level):
   File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
     for chunk in chunks:
   File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
     for chunk in chunks:
   File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
     for chunk in chunks:
   File "/usr/lib/python2.7/json/encoder.py", line 390, in _iterencode_dict
     yield _encoder(value)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 6: invalid continuation byte

And in Python 3 :

 mod_wsgi (pid=6641): Exception occurred processing WSGI script '/usr/share/munin-plot/web.py'. 
 Traceback (most recent call last):
   File "/usr/share/munin-plot/web.py", line 115, in application
     return list_graphs(environ, start_response)
   File "/usr/share/munin-plot/web.py", line 50, in list_graphs
     return [json.dumps(get_info(), indent=2, sort_keys=True).encode('utf-8')]
   File "/usr/share/munin-plot/munin.py", line 43, in wrapper
     data[args] = (function(*args), now)
   File "/usr/share/munin-plot/munin.py", line 63, in get_info
     for line in f:
   File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
     return codecs.ascii_decode(input, self.errors)[0]
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 950: ordinal not in range(128)

So what are the requirements for this software ?
Which information do you need to debug this ?
Thanks a lot !

I've just pushed a3bf192 that should fix this issue hopefully. The code is not very well tested against against a wide range of Munin plugins so there very well could be more exceptions. Feel free to post them.

The last change made this a Python 3 only application though.

Just try but almost same problem :

mod_wsgi (pid=20886): Exception occurred processing WSGI script '/usr/share/munin-plot/web.py'.
Traceback (most recent call last):
File "/usr/share/munin-plot/web.py", line 115, in application
  return list_graphs(environ, start_response)
File "/usr/share/munin-plot/web.py", line 50, in list_graphs
  return [json.dumps(get_info(), indent=2, sort_keys=True).encode('utf-8')]
File "/usr/share/munin-plot/munin.py", line 43, in wrapper
  data[args] = (function(*args), now)
 File "/usr/share/munin-plot/munin.py", line 63, in get_info
   for line in f:
 File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 3153: invalid continuation byte

I think 0xe9 is latin1 char, not UTF-8, as munin put the datafile in latin1. So I change the patch to

encoding='latin1'

And I fall back in another error :

mod_wsgi (pid=23782): Exception occurred processing WSGI script '/usr/share/munin-plot/web.py'.
Traceback (most recent call last):
  File "/usr/share/munin-plot/web.py", line 115, in application
    return list_graphs(environ, start_response)
  File "/usr/share/munin-plot/web.py", line 50, in list_graphs
    return [json.dumps(get_info(), indent=2, sort_keys=True).encode('utf-8')]
  File "/usr/share/munin-plot/munin.py", line 43, in wrapper
     data[args] = (function(*args), now)
   File "/usr/share/munin-plot/munin.py", line 99, in get_info
     for field in _remove_duplicates(graph_order.split())]
  File "/usr/share/munin-plot/munin.py", line 99, in <listcomp>
     for KeyError: '147_173_15_0__24'

munin-plot is now also on pypi.org and is Python 3 only. If you can still reproduce this bug, feel free to re-open this issue or create a new one.