I wanted to make a directory for an input, if the directory did not already exist. When I run the code, it runs fine, but after entering my input, my directory is not created in the folder containing my python file. But, when I run the python code again, and enter the same value, it returns, 'Project already exists'. But no directory was actually created. I did the same thing last week and it worked fine. I have no idea why it's not working now.
# main.py #
import os
def create_project_dir(directory):
if not os.path.exists(directory):
print(' Creating Project : ' + directory)
os.makedirs(directory)
else:
print(' Project already exists. ')
myDir = input('Dir: ')
create_project_dir(myDir)
end = input('done')