I wish to create a directory with relative path.
Here is my code:
if os.path.isdir("Imagettes") is False : os.mkdir("Imagettes") os.makedirs("Imagettes/%Y-%m-%d_%H:%M:%S") However it will return an error:
File "D:\Anaconda3\envs\prunes\lib\os.py", line 223, in makedirs mkdir(name, mode) OSError: [WinError 123] The file, directory, or volume name syntax is incorrect: 'Imagettes/%Y-%m-%d_%H:%M:%S' The directory "Imagette" will be correctly created however the date directory I want to create inside won't. I don't get what's wrong. Can somebody help me find out?
makedirsyou don't need to explicitly createImagettes/.%Y-%m-%d_%H:%M:%S, maybe it's because you wrote '/' and not '\' (assuming you are using windows)