klebgenomics / Kaptive

GNU General Public License v3.0
44 stars 21 forks source link

find_program :: use command -v instead of which #11

Closed EricDeveaud closed 7 months ago

EricDeveaud commented 4 years ago

Hello,

I suggest you use command -v instead of which in kaptive.py find_program

runnig kleborte in a minimalistic docker environement I had th efollowing error from kaptive.py

  File "/opt/gensoft/exe/Kleborate/2.0.0/venv/lib/python3.8/site-packages/kaptive/kaptive.py", line 173, in find_program
    process = subprocess.Popen(['which', name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/opt/gensoft/adm/Python/3.8/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/gensoft/adm/Python/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'which'

fix is pretty easy (when no typos ;-)) see: https://github.com/katholt/Kaptive/pull/12

regards

Eric

tomdstanton commented 7 months ago

Kaptive 3 does not use this method for finding binaries #28