Replace pkg_resources with importlib.resources for Python 3.14 compatibility
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
import pkg_resources
|
||||
from importlib.resources import files
|
||||
import re
|
||||
import shutil
|
||||
|
||||
@@ -92,9 +92,8 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
with open(opts.template_html_index, 'rb') as f:
|
||||
template_html_index_data = f.read()
|
||||
else:
|
||||
with open(pkg_resources.
|
||||
resource_filename('ebook_converter',
|
||||
'data/html_export_default_index.tmpl')
|
||||
with open(str(files('ebook_converter')
|
||||
.joinpath('data/html_export_default_index.tmpl'))
|
||||
) as fobj:
|
||||
template_html_index_data = fobj.read().decode()
|
||||
|
||||
@@ -102,9 +101,8 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
with open(opts.template_html, 'rb') as f:
|
||||
template_html_data = f.read()
|
||||
else:
|
||||
with open(pkg_resources.
|
||||
resource_filename('ebook_converter',
|
||||
'data/html_export_default.tmpl')
|
||||
with open(str(files('ebook_converter')
|
||||
.joinpath('data/html_export_default.tmpl'))
|
||||
) as fobj:
|
||||
template_html_data = fobj.read().decode()
|
||||
|
||||
@@ -112,9 +110,8 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
with open(opts.template_css, 'rb') as f:
|
||||
template_css_data = f.read()
|
||||
else:
|
||||
with open(pkg_resources.
|
||||
resource_filename('ebook_converter',
|
||||
'data/html_export_default.css')
|
||||
with open(str(files('ebook_converter')
|
||||
.joinpath('data/html_export_default.css'))
|
||||
) as fobj:
|
||||
template_css_data = fobj.read().decode()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user