Add @sdushantha suggestion in creating directory.

This commit is contained in:
Christopher K. Hoadley 2019-12-31 15:51:40 -06:00
parent f48a2980f5
commit 1101af8132

View file

@ -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"