Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from util.which to shutil.which #41

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading