Skip to content

Commit

Permalink
per #1706, create output directory if it does not already exist becau…
Browse files Browse the repository at this point in the history
…se the file i/o logic will fail if the directory does not exist
  • Loading branch information
georgemccabe committed Jul 25, 2022
1 parent 502ae62 commit b3a1fd7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
input_file = sys.argv[1]
output_file = sys.argv[2]

output_dir = os.path.dirname(output_file)
if not os.path.exists(output_dir):
print(f'Creating output dir: {output_dir}')
os.makedirs(output_dir)

filelist = open(output_file,'a+')
filelist.write(input_file + '\n')
filelist.close()

0 comments on commit b3a1fd7

Please sign in to comment.