From c674ed493c5c783dd229734ec647943e26bbdc16 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Mon, 30 Sep 2024 15:52:41 +0200 Subject: [PATCH] keep python 2 getDataPath --- prody/utilities/misctools.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/prody/utilities/misctools.py b/prody/utilities/misctools.py index af7446802..63a006c85 100644 --- a/prody/utilities/misctools.py +++ b/prody/utilities/misctools.py @@ -422,9 +422,12 @@ def pystr(a): return b def getDataPath(filename): - import importlib - path = importlib.util.find_spec('prody.utilities.datafiles').submodule_search_locations[0] - return '%s/%s' %(path, filename) + if PY3K: + import importlib + path = importlib.util.find_spec('prody.utilities.datafiles').submodule_search_locations[0] + return '%s/%s' %(path, filename) + import pkg_resources + return pkg_resources.resource_filename('prody.utilities', 'datafiles/%s'%filename) def openData(filename, mode='r'): return open(getDataPath(filename), mode)