From f845cc30653646bd71d3111f50c24a4b88ad4cba Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 20 Sep 2020 18:26:45 -0700 Subject: [PATCH] Use pathclass.Path.open. --- epubfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epubfile.py b/epubfile.py index 68392c8..1037398 100644 --- a/epubfile.py +++ b/epubfile.py @@ -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()