mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-23 08:30:32 +00:00
Make sure file paths is text, not binary
Work around https://bugs.python.org/issue6543 for Python 2
This commit is contained in:
parent
950a64087f
commit
5bd08635f2
2 changed files with 13 additions and 2 deletions
|
@ -4,9 +4,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
##################################################################################################
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
from six import ensure_text
|
||||
|
||||
from kodi_six import xbmc, xbmcaddon
|
||||
import database
|
||||
|
||||
|
@ -86,6 +89,9 @@ class MyFormatter(logging.Formatter):
|
|||
logging.Formatter.__init__(self, fmt)
|
||||
|
||||
def format(self, record):
|
||||
if record.pathname:
|
||||
record.pathname = ensure_text(record.pathname, sys.getfilesystemencoding())
|
||||
|
||||
self._gen_rel_path(record)
|
||||
|
||||
# Call the original formatter class to do the grunt work
|
||||
|
@ -98,6 +104,8 @@ class MyFormatter(logging.Formatter):
|
|||
res = []
|
||||
|
||||
for o in traceback.format_exception(*exc_info):
|
||||
o = ensure_text(o, sys.getfilesystemencoding())
|
||||
|
||||
if o.startswith(' File "'):
|
||||
# If this split can't handle your file names, you should seriously consider renaming your files.
|
||||
fn = o.split(' File "', 2)[1].split('", line ', 1)[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue