mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: make txtz input work
This commit is contained in:
parent
fda2ab0024
commit
aa43816d09
@ -138,7 +138,7 @@ class TXTInput(InputFormatPlugin):
|
|||||||
block_to_single_line, separate_hard_scene_breaks)
|
block_to_single_line, separate_hard_scene_breaks)
|
||||||
|
|
||||||
self.log = log
|
self.log = log
|
||||||
txt = ''
|
txt = b''
|
||||||
log.debug('Reading text from file...')
|
log.debug('Reading text from file...')
|
||||||
length = 0
|
length = 0
|
||||||
base_dir = getcwd()
|
base_dir = getcwd()
|
||||||
@ -151,7 +151,7 @@ class TXTInput(InputFormatPlugin):
|
|||||||
for x in walk('.'):
|
for x in walk('.'):
|
||||||
if os.path.splitext(x)[1].lower() in ('.txt', '.text'):
|
if os.path.splitext(x)[1].lower() in ('.txt', '.text'):
|
||||||
with open(x, 'rb') as tf:
|
with open(x, 'rb') as tf:
|
||||||
txt += tf.read() + '\n\n'
|
txt += tf.read() + b'\n\n'
|
||||||
else:
|
else:
|
||||||
if getattr(stream, 'name', None):
|
if getattr(stream, 'name', None):
|
||||||
base_dir = os.path.dirname(stream.name)
|
base_dir = os.path.dirname(stream.name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user