From 047d539e0a580b858d85c52171960ea93c9a94b0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 19 May 2019 14:22:35 -0400 Subject: [PATCH] py3: os.walk explicitly returns bytes when given a bytes argument And therefore when replacing paths in it, we need to use bytes as well. --- src/calibre/ebooks/oeb/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index d17c73c6d6..98b6ef5c7b 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -605,7 +605,7 @@ class DirContainer(object): for root, dirs, files in os.walk(base): for fname in files: fname = os.path.join(root, fname) - fname = fname.replace('\\', '/') + fname = fname.replace(b'\\', b'/') if not isinstance(fname, unicode_type): try: fname = fname.decode(filesystem_encoding)