b-jesch / service.pvr.manager

GNU General Public License v2.0
4 stars 4 forks source link

Skip empty lines in /etc/os-release #3

Closed RichieB2B closed 6 years ago

RichieB2B commented 6 years ago

Some /etc/os-release files have empty lines (like the OSMC vero4k development branch). This results in:

22:57:38.453 T:2952778480   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ValueError'>
                                            Error Contents: need more than 1 value to unpack
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/service.tvh.manager/default.py", line 11, in <module>
                                                release = tools.release()
                                              File "/home/osmc/.kodi/addons/service.tvh.manager/resources/lib/tools.py", line 47, in __init__
                                                parameter, value = _line.split('=')
                                            ValueError: need more than 1 value to unpack
                                            -->End of Python script error report<--
b-jesch commented 6 years ago

Sorry, saw your code a little bit to late while I have the fix already submitted. But anyway, it is fixed now.

RichieB2B commented 6 years ago

Your fix in 5e6109056708183e25b90b0a25d28435d12c5969 is incomplete. If you catch the exception the parameter variable will be undefined, or worse: it will still be the value from the last iteration which is then cleared. My fix just ignores lines without = in them.

b-jesch commented 6 years ago

Adopted in your way.

RichieB2B commented 6 years ago

Thanks!