Skip to content

Commit

Permalink
keep python 2 getDataPath
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Sep 30, 2024
1 parent e0edf04 commit c674ed4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions prody/utilities/misctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c674ed4

Please sign in to comment.