Use pathclass.Path.open.

This commit is contained in:
Ethan Dalool 2020-09-20 18:26:45 -07:00
parent 621ced7b22
commit f845cc3065

View file

@ -483,7 +483,7 @@ class Epub:
# hasn't been instantiated yet! At this time, creating a book with
# Epub.new always creates it as a directory. We do not support
# creating a book directly into a fresh zip file.
with open(filepath.absolute_path, 'w', encoding='utf-8') as handle:
with filepath.open('w', encoding='utf-8') as handle:
handle.write(content)
uid = uuid.uuid4().urn
@ -1521,7 +1521,7 @@ def addfile_argparse(args):
base = file.replace_extension('').basename
id = f'{base}_{rand_suffix}'
basename = f'{base}_{rand_suffix}{file.extension.with_dot}'
content = open(file.absolute_path, 'rb').read()
content = file.open('rb').read()
book.add_file(id, basename, content)
book.move_nav_to_end()