Skip to content

Commit 78f8996

Browse files
committed
Fail if we cannot make output dirs
Failing to create either of these two dirs should result in an immediate exit, as downstream code assumes that they've been created and will fail ungracefully, with a red-herring error. Further, there are many reasons why `mkdir` can fail, not just because the "Folder already exists". For example, permissions issues can cause a failure, in which case the print statement is misleading.
1 parent 46f81fa commit 78f8996

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tiddit/__main__.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,8 @@ def main():
115115
i+=1
116116

117117
prefix=args.o
118-
try:
119-
os.mkdir( "{}_tiddit".format(prefix) )
120-
os.mkdir("{}_tiddit/clips".format(prefix) )
121-
except:
122-
print("Folder already exists")
118+
os.mkdir(f"{prefix}_tiddit")
119+
os.mkdir(f"{prefix}_tiddit/clips")
123120

124121
pysam.index("-c","-m","6","-@",str(args.threads),bam_file_name,"{}_tiddit/{}.csi".format(args.o,sample_id))
125122

0 commit comments

Comments
 (0)