diff --git a/setup.py b/setup.py index 65c4a44..8298108 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ setup( name='zhconv', - version='1.4.2', + version='1.4.4', description="A simple implementation of Simplified-Traditional Chinese conversion.", long_description=LONGDESC, author='Dingyuan Wang', diff --git a/zhconv/zhconv.py b/zhconv/zhconv.py index 0a8d8e3..11fbaa9 100644 --- a/zhconv/zhconv.py +++ b/zhconv/zhconv.py @@ -22,7 +22,7 @@ """ # Only Python3 can pass the doctest here due to unicode problems. -__version__ = '1.4.2' +__version__ = '1.4.4' import os import sys @@ -30,8 +30,12 @@ import json try: - from pkg_resources import resource_stream - get_module_res = lambda *res: resource_stream(__name__, os.path.join(*res)) + if sys.version_info >= (3, 9): + from importlib.resources import files + else: + from importlib_resources import files + + get_module_res = lambda *res: files(__name__).joinpath(*res).open('rb') except ImportError: get_module_res = lambda *res: open(os.path.normpath( os.path.join(os.getcwd(), os.path.dirname(__file__), *res)), 'rb')