mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
py3: fix creation of empty record with .txt format
Metadata objects are unicode strings, but we tried to write the content directly to a .txt file opened in binary mode.
This commit is contained in:
parent
788278b97e
commit
cc2eefbb17
@ -42,7 +42,7 @@ def create_book(mi, path, fmt='epub', opf_name='metadata.opf', html_name='start.
|
|||||||
if fmt == 'txt':
|
if fmt == 'txt':
|
||||||
with open(path, 'wb') as f:
|
with open(path, 'wb') as f:
|
||||||
if not mi.is_null('title'):
|
if not mi.is_null('title'):
|
||||||
f.write(mi.title)
|
f.write(mi.title.encode('utf-8'))
|
||||||
return
|
return
|
||||||
if fmt == 'docx':
|
if fmt == 'docx':
|
||||||
from calibre.ebooks.conversion.plumber import Plumber
|
from calibre.ebooks.conversion.plumber import Plumber
|
||||||
|
Loading…
x
Reference in New Issue
Block a user