mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
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.
This commit is contained in:
parent
00ed9305cb
commit
047d539e0a
@ -605,7 +605,7 @@ class DirContainer(object):
|
|||||||
for root, dirs, files in os.walk(base):
|
for root, dirs, files in os.walk(base):
|
||||||
for fname in files:
|
for fname in files:
|
||||||
fname = os.path.join(root, fname)
|
fname = os.path.join(root, fname)
|
||||||
fname = fname.replace('\\', '/')
|
fname = fname.replace(b'\\', b'/')
|
||||||
if not isinstance(fname, unicode_type):
|
if not isinstance(fname, unicode_type):
|
||||||
try:
|
try:
|
||||||
fname = fname.decode(filesystem_encoding)
|
fname = fname.decode(filesystem_encoding)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user