I'm writing a bash-like Windows command prompt in python for fun and I need to catch the 'Directory not empty' error to prevent my program from crashing. How can I do this?
import os, sys
# Take the user input
user_input = input()
# Split the user input
parts = user_input.split()
# Remove a directory
if "rmdir" == parts[0]:
os.rmdir(os.getcwd() + "\\" + parts[1])