Skip to content

Commit

Permalink
[cocopp] Use importlib to for paths relative to cocopp
Browse files Browse the repository at this point in the history
Partial fix for #2229
  • Loading branch information
olafmersmann committed Nov 27, 2023
1 parent 1a12432 commit 680313a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code-postprocessing/cocopp/toolsdivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,8 @@ def get_version_label(algorithmID=None):


def path_in_package(sub_path=""):
import pkg_resources
from importlib import resources as res
"""return the absolute path prepended to `subpath` in this module.
"""
egg_info = pkg_resources.require('cocopp')[0]
return os.path.join(egg_info.location, egg_info.project_name, sub_path)
import .. as cocopp
return str(res.files(cocopp) / subpath)

0 comments on commit 680313a

Please sign in to comment.