<?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: Creating a geodatabase and setting it to env.workspace in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395488#M31236</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you check to make sure it creates the GDB?&amp;nbsp; I think its not creating it at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make line 11 just:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy&lt;SPAN&gt;.&lt;/SPAN&gt;CreateFileGDB_management&lt;SPAN&gt;(&lt;/SPAN&gt;basedir&lt;SPAN&gt;,&lt;/SPAN&gt; gdb_name&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Right now instead of creating the actual gdb, you are setting a variable equal to it, which I'm not sure what that would do but it likely isn't creating it.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Mar 2017 14:23:15 GMT</pubDate>
    <dc:creator>IanMurray</dc:creator>
    <dc:date>2017-03-23T14:23:15Z</dc:date>
    <item>
      <title>Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395484#M31232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any reason why this wouldn't be working?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os

basedir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'C:\\Temp'&lt;/SPAN&gt;
gdb_name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'TestGDB'&lt;/SPAN&gt;
gdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;basedir&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; gdb_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Exists&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gdb
&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFileGDB_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;basedir&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; gdb_name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gdb‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must not be understanding how .Exists() resolves, for if the gdb already exists, it gives me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcgisscripting.ExecuteError: ERROR 000258: Output C:\Temp\TestGDB.gdb already exists&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Failed to execute (CreateFileGDB)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the gdb does not exist, it gives me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RuntimeError: Object: Error in accessing environment &amp;lt;workspace&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395484#M31232</guid>
      <dc:creator>EricEagle</dc:creator>
      <dc:date>2021-12-11T18:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395485#M31233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When creating the file geodatabase path for setting a workspace, you need to include the ".gdb" on the end, otherwise you are setting the workspace to a folder.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 14:03:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395485#M31233</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-03-23T14:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395486#M31234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are missing the file extension&amp;nbsp; in your gdb variable.&amp;nbsp; gdb_name needs the extension on it before you join the path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 14:04:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395486#M31234</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-03-23T14:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395487#M31235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ian/Joshua,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I include the .gdb extension (gdb_name = 'TestGDB.gdb') and the geodatabase exists, it completes. &amp;nbsp;When the geodatabase does &lt;EM&gt;not&lt;/EM&gt; exist, it creates the TestGDB.gdb object, but still gives me the same runtime error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 14:12:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395487#M31235</guid>
      <dc:creator>EricEagle</dc:creator>
      <dc:date>2017-03-23T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395488#M31236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you check to make sure it creates the GDB?&amp;nbsp; I think its not creating it at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make line 11 just:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy&lt;SPAN&gt;.&lt;/SPAN&gt;CreateFileGDB_management&lt;SPAN&gt;(&lt;/SPAN&gt;basedir&lt;SPAN&gt;,&lt;/SPAN&gt; gdb_name&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Right now instead of creating the actual gdb, you are setting a variable equal to it, which I'm not sure what that would do but it likely isn't creating it.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 14:23:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395488#M31236</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-03-23T14:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395489#M31237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ian. &amp;nbsp;It felt like I should be able to dump the method into a variable in one step like other methods to save a line of code, but regardless, it works now, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 14:27:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395489#M31237</guid>
      <dc:creator>EricEagle</dc:creator>
      <dc:date>2017-03-23T14:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395490#M31238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm it does create the GDB when you set it equal to a variable.&amp;nbsp;I guess the issue with your script is the fact that arcpy.env.workspace is looking for a workspace as an input, whereas you were setting it equal to geoprocessing operation that creates the workspace.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 14:56:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395490#M31238</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-03-23T14:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395491#M31239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to provide more insight, if you print the gdb variable, you'll get "&amp;lt;&lt;SPAN style="background-color: #ffffff;"&gt;basedir&amp;gt;\&amp;lt;gdb_name&amp;gt;". &amp;nbsp;The OS separator between the out file path and FGDB name isn't escaped properly, as it's set to a backslash, which is why you see that runtime error when trying to use the gdb variable as is. &amp;nbsp;In one line, this worked:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gdb = str(arcpy.CreateFileGDB_management(outDir,outName)).replace("\\","/")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can replace the single backslash, (escaped with a double backslash), with a forward slash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 19:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395491#M31239</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2017-03-23T19:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395492#M31240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcGIS 10.5, and Create File GDB returns properly escaped results:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; var &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFileGDB_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'C:\tmp'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'test'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; var
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;Result &lt;SPAN class="string token"&gt;'C:\\tmp\\test.gdb'&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Exists&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;var&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The double backslashes are perfectly valid, they don't have to be forward slashes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395492#M31240</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T18:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395493#M31241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you call on the variable without printing, it'll be correct as a Result object. &amp;nbsp;If you print the variable you'll see the backslash is not escaped:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; gdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFileGDB_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"C:/Temp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"blah.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; gdb
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;Result &lt;SPAN class="string token"&gt;'C:/Temp\\blah.gdb'&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt;Temp\blah&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gdb
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Exists&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gdb
Runtime error 
Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 File &lt;SPAN class="string token"&gt;"&amp;lt;string&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
 File &lt;SPAN class="string token"&gt;"c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\geoprocessing\_base.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;541&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; set_
 self&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; val
 File &lt;SPAN class="string token"&gt;"c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\geoprocessing\_base.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;601&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; __setitem__
 ret_ &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; setattr&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_gp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; item&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; value&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
RuntimeError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Object&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Error &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; accessing environment &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;workspace&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\\"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"/"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace
u&lt;SPAN class="string token"&gt;'C:/Temp/blah.gdb'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There seems to be different implementations of arcpy.Exists and arcpy.env.workspace, as the latter seems to look at the result as a string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395493#M31241</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2021-12-11T18:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395494#M31242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is right on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/people/eric.eagle" target="_blank"&gt;eric.eagle&lt;/A&gt; It's a little confusing that you have named the result object the same as the gdb full path. A better way to implement this is:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;r_gdb = arcpy.CreateFileGDB_management(basedir, gdb_name)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The result object can be used as input parameter to a tool, in which case it will be converted to a path. Or you can convert it to a path yourself with either of these statements -- or just use&amp;nbsp;&lt;STRONG&gt;gdb&lt;/STRONG&gt; which you set earlier in the code.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;gdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r_gdb&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getOutput&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
gdb &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r_gdb&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395494#M31242</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T18:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395495#M31243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This one fascinated me a bit.&amp;nbsp; On one hand, I am surprised I haven't run into the issue before; but on the other hand, I don't work with the &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;GPEnvironment&lt;/SPAN&gt; class much, at least not directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.env&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.Exists&lt;/SPAN&gt; both go through &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.geoprocessing._base&lt;/SPAN&gt;, it got me wondering why passing a Result object to one works fine but the other one chokes.&amp;nbsp; It turns out, one uses &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;gp_fixargs&lt;/SPAN&gt; while the other one doesn't.&amp;nbsp; &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;gp_fixargs&lt;/SPAN&gt; is designed to do several things, one of which being extract values from Result objects:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geoprocessing&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_base &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; gp_fixargs
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; res &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateFileGDB_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\tmp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"test"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; type&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;res&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'arcpy.arcobjects.arcobjects.Result'&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; res
&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;Result &lt;SPAN class="string token"&gt;'C:\\tmp\\test.gdb'&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; fixed_args &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gp_fixargs&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;res&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; fixed_args
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;u&lt;SPAN class="string token"&gt;'C:\\tmp\\test.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; fixed_args&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
u&lt;SPAN class="string token"&gt;'C:\\tmp\\test.gdb'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; 
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; unicode&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;res&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;_arc_object&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
u&lt;SPAN class="string token"&gt;'C:\\tmp\\test.gdb'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Both &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.env&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.Exists&lt;/SPAN&gt; check for the presence of an &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;_arc_object&lt;/SPAN&gt; property.&amp;nbsp; Whereas &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.Exists&lt;/SPAN&gt; uses&lt;SPAN style="font-family: courier new,courier,monospace;"&gt; gp_fixargs&lt;/SPAN&gt;, &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.env&lt;/SPAN&gt; simply tries to use the &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;_arc_object&lt;/SPAN&gt; value directly instead of passing it to &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;unicode&lt;/SPAN&gt; first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess a question for Esri is why doesn't &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;arcpy.env&lt;/SPAN&gt; use &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;gp_fixargs&lt;/SPAN&gt;?&amp;nbsp; I assume it creates some problem somewhere, but who knows, maybe it is simply an oversight.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395495#M31243</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T18:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a geodatabase and setting it to env.workspace</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395496#M31244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for digging that up, Joshua. You know how much I like a little dirt on how they do stuff underneath what's documented!&lt;/P&gt;&lt;P&gt;Maybe it was kind of a design decision, arcpy.env is not a tool, so you should hand it a string or a non-result object.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Mar 2017 16:33:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-geodatabase-and-setting-it-to-env/m-p/395496#M31244</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-03-25T16:33:49Z</dc:date>
    </item>
  </channel>
</rss>

