From 1101af81320f0dde45cb9907b9e7f109cfcd6ffa Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Tue, 31 Dec 2019 15:51:40 -0600 Subject: [PATCH] Add @sdushantha suggestion in creating directory. --- sherlock/sherlock.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index 08e6e15d..13b9dcfd 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -620,12 +620,8 @@ def main(): result_file = args.output elif args.folderoutput: # The usernames results should be stored in a targeted folder. - # If the folder doesnt exist, create it first - try: - os.mkdir(args.folderoutput) - except FileExistsError: - #directory already exists - pass + # If the folder doesn't exist, create it first + os.makedirs(args.folderoutput, exist_ok=True) result_file = os.path.join(args.folderoutput, f"{username}.txt") else: result_file = f"{username}.txt"