DeBaschdi / service.takealug.epg-grabber

kodi Addon to grab epg data from different providers
GNU General Public License v3.0
27 stars 5 forks source link

Python3 incompatibility : binary mode doesn't take an encoding argument #10

Closed Chaotnix closed 3 years ago

Chaotnix commented 3 years ago

When runnning the grabber on my RPI4 with Libreelec 10.0.0 Beta (Kodi 19 Matrix) the following error is thrown:

ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ValueError'>
                                                   Error Contents: binary mode doesn't take an encoding argument
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/service.takealug.epg-grabber/service.py", line 575, in <module>
                                                       run_grabber()
                                                     File "/storage/.kodi/addons/service.takealug.epg-grabber/service.py", line 387, in run_grabber
                                                       write_to_sock()
                                                     File "/storage/.kodi/addons/service.takealug.epg-grabber/service.py", line 393, in write_to_sock
                                                       epg = open(guide_temp, 'rb', encoding='utf-8')
                                                   ValueError: binary mode doesn't take an encoding argument
                                                   -->End of Python script error report<--

In line 393 in service.py, guide_temp is opened in binary mode with encoding='utf-8' When opening a file in binary mode, encoding is not needed. So encoding option in binary mode is no more allowed in Python 3.

The solution ist to change line 393 from

epg = open(guide_temp, 'rb', encoding='utf-8') to epg = open(guide_temp, 'rb')

After this change the plugin is working for me again.

DeBaschdi commented 3 years ago

THX, fixed in 1.1.1