Skip to content

Commit

Permalink
added a fix for running on Kodi 16
Browse files Browse the repository at this point in the history
  • Loading branch information
elgatito committed May 23, 2020
1 parent 41d722d commit 30b1f45
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions resources/site-packages/kodi_six/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
]

PY2 = sys.version_info[0] == 2 #: ``True`` for Python 2

PY26 = sys.version_info < (2,7,0)

def py2_encode(s, encoding='utf-8', errors='strict'):
"""
Expand Down Expand Up @@ -57,8 +57,12 @@ def encode_decode(func):
if PY2:
def wrapper(*args, **kwargs):
mod_args = tuple(py2_encode(item) for item in args)
mod_kwargs = {key: py2_encode(value) for key, value
in kwargs.iteritems()}
if PY26:
mod_kwargs = dict((key, py2_encode(value))
for key, value in kwargs.iteritems())
else:
mod_kwargs = {key: py2_encode(value) for key, value
in kwargs.iteritems()}
return py2_decode(func(*mod_args, **mod_kwargs),
errors='replace')
wrapper.__name__ = 'wrapped_func_{0}'.format(func.__name__)
Expand Down

0 comments on commit 30b1f45

Please sign in to comment.