| 1 |
From: Olivier Sallou <[email protected]> |
| 2 |
Date: Wed, 27 Mar 2019 08:03:04 +0000 |
| 3 |
Subject: do not create dir if it exists |
| 4 |
|
| 5 |
Bug-Debian: https://bugs.debian.org/925568 |
| 6 |
Forwarded: no |
| 7 |
Last-Updated: 2025-02-06 |
| 8 |
|
| 9 |
command tries to create an output dir during tests, even if it |
| 10 |
already exists, raising an error. Skip creation if already present |
| 11 |
--- |
| 12 |
cnvlib/commands.py | 5 +++-- |
| 13 |
1 file changed, 3 insertions(+), 2 deletions(-) |
| 14 |
|
| 15 |
diff --git a/cnvlib/commands.py b/cnvlib/commands.py |
| 16 |
index a521136..0d01b54 100644 |
| 17 |
--- a/cnvlib/commands.py |
| 18 |
+++ b/cnvlib/commands.py |
| 19 |
@@ -2427,8 +2427,9 @@ def _cmd_import_picard(args: argparse.Namespace) -> None: |
| 20 |
) |
| 21 |
if args.output_dir: |
| 22 |
if not os.path.isdir(args.output_dir): |
| 23 |
- os.mkdir(args.output_dir) |
| 24 |
- logging.info("Created directory %s", args.output_dir) |
| 25 |
+ if not os.path.exists(args.output_dir): |
| 26 |
+ os.mkdir(args.output_dir) |
| 27 |
+ logging.info("Created directory %s", args.output_dir) |
| 28 |
outfname = os.path.join(args.output_dir, outfname) |
| 29 |
tabio.write(garr, outfname) |
| 30 |
|