Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python_wrapper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'python-dotenv',
'yagmail',
'Werkzeug',
'importlib_resources>=5.10',
],
include_package_data=True,
entry_points={
Expand Down
8 changes: 5 additions & 3 deletions python_wrapper/twa/resRegistry/resRegistry.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import pkg_resources
import importlib_resources
import json
import os
import shutil
import keyword
import builtins
import textwrap

_RES_DIR = pkg_resources.resource_filename(__name__, os.path.join('..','resources'))
_RES_DIR = importlib_resources.files(__name__).joinpath('..','resources')
_RES_REG_FILE = 'resources_registry.json'
_DEF_RES_META_FILE = 'default_resources.json'
_URL_ID = 'url://'
Expand All @@ -24,7 +24,9 @@ def __init__(self):
Constructs the registry object. If regsitry file does not exists, it creates one on the fly.
"""
try:
self.resReg = json.load(pkg_resources.resource_stream(__name__, os.path.join('..','resources',_RES_REG_FILE)))
resource_path = importlib_resources.files(__name__).joinpath('..', 'resources', _RES_REG_FILE)
with importlib_resources.open_text(__name__, resource_path) as resource_file:
self.resReg = json.load(resource_file)
except FileNotFoundError:
self.resReg = {'resources':{}}
self._updateRegFile()
Expand Down
Loading