Skip to content

Commit

Permalink
switch from util.which to shutil.which (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
IAlibay authored Nov 12, 2023
1 parent d65dc01 commit 83bfc40
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mdahole2/analysis/hole.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#
import os
import errno
import shutil
import tempfile
import textwrap
import logging
Expand Down Expand Up @@ -217,7 +218,7 @@ def hole(pdbfile,
warnings.warn(msg.format(output_level))

# get executable
exe = util.which(executable)
exe = shutil.which(executable)
if exe is None:
raise OSError(errno.ENOENT, exe_err.format(name=executable,
kw='executable'))
Expand Down Expand Up @@ -500,23 +501,23 @@ def __init__(self, universe,
self.ignore_residues = ignore_residues

# --- finding executables ----
hole = util.which(executable)
hole = shutil.which(executable)
if hole is None:
raise OSError(errno.ENOENT, exe_err.format(name=executable,
kw='executable'))
self.base_path = os.path.dirname(hole)

sos_triangle_path = util.which(sos_triangle)
sos_triangle_path = shutil.which(sos_triangle)
if sos_triangle_path is None:
path = os.path.join(self.base_path, sos_triangle)
sos_triangle_path = util.which(path)
sos_triangle_path = shutil.which(path)
if sos_triangle_path is None:
raise OSError(errno.ENOENT, exe_err.format(name=sos_triangle,
kw='sos_triangle'))
sph_process_path = util.which(sph_process)
sph_process_path = shutil.which(sph_process)
if sph_process_path is None:
path = os.path.join(self.base_path, sph_process)
sph_process_path = util.which(path)
sph_process_path = shutil.which(path)
if sph_process_path is None:
raise OSError(errno.ENOENT, exe_err.format(name=sph_process,
kw='sph_process'))
Expand Down

0 comments on commit 83bfc40

Please sign in to comment.