mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -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':
|
||||
with open(path, 'wb') as f:
|
||||
if not mi.is_null('title'):
|
||||
f.write(mi.title)
|
||||
f.write(mi.title.encode('utf-8'))
|
||||
return
|
||||
if fmt == 'docx':
|
||||
from calibre.ebooks.conversion.plumber import Plumber
|
||||
|
Loading…
x
Reference in New Issue
Block a user