Folder operations Check for existence and create if not os.path.exists( export_directory ) : os.makedirs(export_directory) os.mkdir(export_directory) Get the base directory parent_folder_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))