It appears that OUTPUT_DIR is the base directory, and you're trying to create two files within it. However, when you're specifying the file paths for writing, you're not directly referencing OUTPUT_DIR for the second file.
You're using args.output, which only contains the filename, not the full path. To ensure that both files are created within the OUTPUT_DIR, you should use os.path.join() to construct the full file paths
create_dir(OUTPUT_DIR) # Create the output directory if not exists
with open(os.path.join(OUTPUT_DIR, 'school-center-distance.tsv'), 'w', encoding='utf-8') as intermediate_file, \
open(os.path.join(OUTPUT_DIR, args.output), 'w', encoding='utf-8') as a_file:
This way, both files will be created within the OUTPUT_DIR, resolving the issue with the output directory generation.
It appears that OUTPUT_DIR is the base directory, and you're trying to create two files within it. However, when you're specifying the file paths for writing, you're not directly referencing OUTPUT_DIR for the second file.
You're using args.output, which only contains the filename, not the full path. To ensure that both files are created within the OUTPUT_DIR, you should use os.path.join() to construct the full file paths
This way, both files will be created within the OUTPUT_DIR, resolving the issue with the output directory generation.