From 2903febd2767ffd94f62f8e0b151e627e15b09d5 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 4 Jun 2018 13:05:24 +0300 Subject: [PATCH] Fix(inpx): Fix decoding filenames to unicode --- m_librarian/inp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/m_librarian/inp.py b/m_librarian/inp.py index d0b567a..3789dd2 100644 --- a/m_librarian/inp.py +++ b/m_librarian/inp.py @@ -1,6 +1,5 @@ import os -import sys from zipfile import ZipFile from sqlobject import sqlhub from sqlobject.sqlbuilder import Select @@ -73,11 +72,10 @@ def import_inp_line(archive, parts): book.addGenre(genre_row) -if sys.version[0] == 2: - def tounicode(s): +def tounicode(s): + if isinstance(s, bytes): return s.decode('utf-8') -else: - def tounicode(s): + else: return s -- 2.39.2