Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Error: FAILED: Directory already exists #571
I am trying to initialize my migration inside a docker image with the command:
For this I will have to map the volume in my system as follows:
But this throws the error
if os.access(directory, os.F_OK): raise util.CommandError("Directory %s already exists" % directory)
Because of this, I won't be able to initialize my migrations as without volume mapping there is no way to persist the
Is there any reason why we are doing so?
it is standard practice that when a unix application is to create a directory and put things into it, that it would not proceed if the directory is already present, because this indicates existing intent. Normally then, I would suggest you create your mount point one directory upwards of where this subdirectory is to be.
However, as I sought to illustrate an example of how this practice is common, it turns out that git, the best example, has since refined their behavior to check if the directory exists and is also non-empty:
so this is an enhancement to the existing feature, and looks like this:
it's still not fully correct since "foo" might exist and not be a directory, but that at least raises "not a directory". Also, I never wrote any tests for this and I'd like to do that too.