Even after I set the path for the default database with arcpy environment variable, ArcMap does not change the default database directory?

At first my arcpy.env.workspace looks like below:

>>> arcpy.env.workspace

enter image description here

The Default1.gdb is highlighted by bold font.

Now I will try to set Gurminder as default gdb through the arcpy.env.workspace variable.

>>> arcpy.env.workspace
>>> arcpy.env.workspace = r"C:\Users\g.bharani@cgiar.org\Documents\ArcGIS\Gurminder.gdb"
>>> arcpy.env.workspace

Even after refreshing the Catalog the default gdb is still Default1.gdb, the Catalog looks like following: enter image description here

Because of this I am not able to store data in my customized default directory.

The results of clip, resample and other tools are still getting stored in Default1.gdb although I have change the arcpy.env.workspace to Gurminder.gdb

Why is it happening so?


The arcpy.env.workspace is used to set the current working directory or current workspace environment from which you can read and write your data. It will not change the default workspace.

If you need to change the default working space, check Setting the default geodatabase.

Also, check if period "." and "@" in your path can cause a problem or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.