Skip to content

Commit

Permalink
fix pkg_resources for PY3K
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Sep 12, 2024
1 parent 0ffa953 commit e1f4c6f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,13 @@ def get_energy(pair, source):

pair = [aa_correction.get(aa, aa) for aa in pair]

try:
# Python 3
with pkg_resources.path('prody.proteins', 'tabulated_energies.txt') as file_path:
data = np.loadtxt(file_path, dtype=str)
except:
# Python 2.7
import pkg_resources
if PY3K:
file_path = pkg_resources.path('prody.proteins', 'tabulated_energies.txt')
else:
file_path = pkg_resources.resource_filename('prody.proteins', 'tabulated_energies.txt')
with open(file_path) as f:
data = np.loadtxt(f, dtype=str)

with open(file_path) as f:
data = np.loadtxt(f, dtype=str)

sources = ["IB_nosolv", "IB_solv", "CS"]
aa_pairs = []
Expand Down

0 comments on commit e1f4c6f

Please sign in to comment.