<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: get default environment in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235052#M18221</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yes, but that doesn't work for my case... I am playing with a python addin on ArcMap open document, and if env.workspace is set before I won't have the default workspace...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you talking about ArcMap's &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//006600000451000000"&gt;default geodatabase&lt;/A&gt;&lt;SPAN&gt;? That's a different thing than the geoprocessing workspace, and only comes into play in the ArcMap UI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The default env.workspace for new map documents is the one active the last time ArcCatalog closed. You could probably read it using Python from the HKCU part of the registry. It can be null, in which case often tools use TEMP, or sometimes Default.gdb in the users's My Documents\ArcGIS folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe if you explain your use case we can help -- what do you intend to do with this location?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Mar 2014 12:55:14 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2014-03-18T12:55:14Z</dc:date>
    <item>
      <title>get default environment</title>
      <link>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235049#M18218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am working on a little script, and I would like to get the default environment (more specifically the default geoprocessing workspace).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I get that? I am looking at a way to create a new instance of arcpy module and get it from there, but I am not sure how to do that!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hugo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 07:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235049#M18218</guid>
      <dc:creator>HugoAhlenius</dc:creator>
      <dc:date>2014-03-18T07:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: get default environment</title>
      <link>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235050#M18219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can get/set your default workspace using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

# Get WS
current_Workspace = arcpy.env.workspace

# Set the workspace environment to local file geodatabase
arcpy.env.workspace = "C:/data/base.gdb"

#set to SDE file
arcpy.env.workspace = r"c:\data\base.sde"


&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you can check ArcGIS Help for more info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Current_Workspace/001w00000002000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#/Current_Workspace/001w00000002000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:51:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235050#M18219</guid>
      <dc:creator>AhmedEl-Sisi</dc:creator>
      <dc:date>2021-12-11T11:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: get default environment</title>
      <link>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235051#M18220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, but that doesn't work for my case... I am playing with a python addin on ArcMap open document, and if env.workspace is set before I won't have the default workspace...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 12:18:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235051#M18220</guid>
      <dc:creator>HugoAhlenius</dc:creator>
      <dc:date>2014-03-18T12:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: get default environment</title>
      <link>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235052#M18221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yes, but that doesn't work for my case... I am playing with a python addin on ArcMap open document, and if env.workspace is set before I won't have the default workspace...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you talking about ArcMap's &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//006600000451000000"&gt;default geodatabase&lt;/A&gt;&lt;SPAN&gt;? That's a different thing than the geoprocessing workspace, and only comes into play in the ArcMap UI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The default env.workspace for new map documents is the one active the last time ArcCatalog closed. You could probably read it using Python from the HKCU part of the registry. It can be null, in which case often tools use TEMP, or sometimes Default.gdb in the users's My Documents\ArcGIS folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe if you explain your use case we can help -- what do you intend to do with this location?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Mar 2014 12:55:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235052#M18221</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-03-18T12:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: get default environment</title>
      <link>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235053#M18222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is what I would like to do: to create a simple python add-in that sets the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;env.workspace&lt;/SPAN&gt;&lt;SPAN&gt; when opening a document. So that operations in the python pane to the same folder that the mxd reside in. But I don't want to set it if the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;default geodatabase&lt;/SPAN&gt;&lt;SPAN&gt; has been set in the ArcMap document properties, then that is preferable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I need a way to check if the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;default geodatabase &lt;/SPAN&gt;&lt;SPAN&gt;property is set or not! (i.e. if it is not the default value)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 07:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-default-environment/m-p/235053#M18222</guid>
      <dc:creator>HugoAhlenius</dc:creator>
      <dc:date>2014-03-20T07:32:21Z</dc:date>
    </item>
  </channel>
</rss>

