I was having this same issue until I had an aha moment.
directory (or d in this case) needs to open the path you want to make the directory at
so… d.open(path)
you should set the path variable to a directory that exists already and you will be making the new directory in that existing directory.
the reason on a exported game why this does not work is because d’s current directory is “res://” which is inside of your executable and not accesible