Skip to content

Commit b29f503

Browse files
committed
Add an error in gecco convert when input is not a folder
1 parent e7a0132 commit b29f503

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

gecco/cli/commands/convert.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ def _convert_gbk_bigslice(self, ctx: contextlib.ExitStack) -> None:
9292
from Bio.SeqFeature import SeqFeature, FeatureLocation
9393
from ...model import ClusterTable
9494

95-
# locate original folder
96-
if not os.path.exists(self.input_dir):
97-
self.error("Could not find input folder:", repr(self.input_dir))
98-
raise CommandExit(errno.ENOENT)
9995
# collect `*.clusters.tsv` files
10096
cluster_files = glob.glob(os.path.join(self.input_dir, "*.clusters.tsv"))
10197
unit = "table" if len(cluster_files) == 1 else "tables"
@@ -262,6 +258,13 @@ def execute(self, ctx: contextlib.ExitStack) -> int: # noqa: D102
262258
self._check()
263259
ctx.enter_context(self.progress)
264260
ctx.enter_context(patch_showwarnings(self._showwarnings)) # type: ignore
261+
# check the input is a folder
262+
if not os.path.exists(self.input_dir):
263+
self.error("Could not find input folder:", repr(self.input_dir))
264+
raise CommandExit(errno.ENOENT)
265+
elif not os.path.isdir(self.input_dir):
266+
self.error("Input is not a folder:", repr(self.input_dir))
267+
raise CommandExit(errno.ENOTDIR)
265268
# run the appropriate method
266269
if self.args["gbk"]:
267270
if self.args["--format"] == "bigslice":

0 commit comments

Comments
 (0)