It might be the os.makedirs() call. I was able to create a folder and save a file using os.mkdir().
os.makedirs()
os.mkdir()