From 9cd429f4836faef13daa83bfa78be98cb4b69e8d Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Wed, 2 Oct 2024 16:50:06 +0200 Subject: [PATCH] dispatch from pythonpath --- .../workflow/snakemake_invoke.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/depiction_targeted_preproc/workflow/snakemake_invoke.py b/src/depiction_targeted_preproc/workflow/snakemake_invoke.py index 61edc88..a61e95a 100644 --- a/src/depiction_targeted_preproc/workflow/snakemake_invoke.py +++ b/src/depiction_targeted_preproc/workflow/snakemake_invoke.py @@ -1,11 +1,11 @@ import contextlib import os import shlex -import shutil import subprocess from dataclasses import dataclass from pathlib import Path +import sys from loguru import logger @@ -95,11 +95,10 @@ def _invoke_subprocess(self, work_dir: Path, result_files: list[Path], extra_arg ) def get_base_command(self, extra_args: list[str], work_dir: Path) -> list[str]: - snakemake_bin = shutil.which("snakemake") - if snakemake_bin is None: - raise RuntimeError(f"snakemake not found, check PATH: {os.environ['PATH']}") return [ - snakemake_bin, + sys.executable, + "-m", + "snakemake", "-d", str(work_dir.absolute()), "--cores",