<?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: Trouble Running Geodatabase Compress as Python Script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166902#M12872</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming that the error on line 41 referrers to line 7 in your snippet, you might use a print statement to see what the variable gdb[0] is referencing.&amp;nbsp; I also notice that later you are referencing gdb[1] for messaging which is also puzzling.&amp;nbsp; Since gdb appears to be a tuple/list, you might try a print statement just to verify that it is what is expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 May 2020 19:48:26 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2020-05-27T19:48:26Z</dc:date>
    <item>
      <title>Trouble Running Geodatabase Compress as Python Script</title>
      <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166900#M12870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have had a Python 2/ArcMap script to compress enterprise geodatabases.&amp;nbsp; The script has worked fine for a while now.&amp;nbsp; I recently converted the script to Python 3/ArcGIS Pro.&amp;nbsp;Now, I keep getting the same error (see below).&amp;nbsp; I've tried referencing the sde connection files using os.path.join and as a single variable (drive/letter/file).&amp;nbsp;I'm looping through a list of geodatabases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Error: Failed to execute. Parameters are not valid.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ERROR 000837: The workspace is not the correct workspace type.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Failed to execute (Compress).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FILE: compress_geodatabases.py, LINE: 41&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"arcpy.management.Compress(gdb[0])": Failed to execute. Parameters are not valid.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;ERROR 000837: The workspace is not the correct workspace type.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Failed to execute (Compress).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Error compressing CCGIS.sde&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# compress geodatabases&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; gdb &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; geodatabases&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# start time for compress&lt;/SPAN&gt;
            start_time_compress &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;perf_counter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# compress tool&lt;/SPAN&gt;
            arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Compress&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&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;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# end time for compress&lt;/SPAN&gt;
            end_time_compress &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; time&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;perf_counter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# elapsed time compress&lt;/SPAN&gt;
            elapsed_time_compress &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; end_time_compress &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; start_time_compress
            &lt;SPAN class="comment token"&gt;# round elapsed time&lt;/SPAN&gt;
            elapsed_time_compress_rounded &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; round&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;elapsed_time_compress&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            &lt;SPAN class="comment token"&gt;# add message&lt;/SPAN&gt;
            log_message &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\nCompressed {} in {}-seconds\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; elapsed_time_compress_rounded&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; EnvironmentError &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            log_message &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; print_errors&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;print_exception&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;e&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            log_message &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\nError compressing {}\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; e&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            log_message &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; print_errors&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;print_exception&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;e&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
            log_message &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'\nError compressing {}\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gdb&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;# end for in&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;/SPAN&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 08:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166900#M12870</guid>
      <dc:creator>PatrickMcKinney1</dc:creator>
      <dc:date>2021-12-11T08:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Running Geodatabase Compress as Python Script</title>
      <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166901#M12871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The&amp;nbsp;script shown only goes to line 22; which one refers to line 41?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the ESRI example to to that maintenance routine, and as I recall, there was something iffy about it either with the 64 bit python and/or python 3.x.&amp;nbsp; I'll ping my former co-workers and ask them about it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2020 18:33:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166901#M12871</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-05-27T18:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Running Geodatabase Compress as Python Script</title>
      <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166902#M12872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming that the error on line 41 referrers to line 7 in your snippet, you might use a print statement to see what the variable gdb[0] is referencing.&amp;nbsp; I also notice that later you are referencing gdb[1] for messaging which is also puzzling.&amp;nbsp; Since gdb appears to be a tuple/list, you might try a print statement just to verify that it is what is expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2020 19:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166902#M12872</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-05-27T19:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Running Geodatabase Compress as Python Script</title>
      <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166903#M12873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It turns out I needed a newer Microsoft SQL server driver installed on the server running the script. gdb[0] was a sde connection file. gdb[1] was a common name for the database.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 17:41:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166903#M12873</guid>
      <dc:creator>PatrickMcKinney1</dc:creator>
      <dc:date>2020-05-28T17:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Running Geodatabase Compress as Python Script</title>
      <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166904#M12874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Love those simple solutions!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2020 17:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/166904#M12874</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-05-28T17:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Running Geodatabase Compress as Python Script</title>
      <link>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/1034058#M60295</link>
      <description>&lt;P&gt;I am currently running into this.&amp;nbsp; I ran into it after converting to Python 3 on my old server.&amp;nbsp; Just moved to an entirely new set of servers, and I'm having issues getting my admin script to run on the new server.&amp;nbsp; Was working Friday, walked in this morning to see that workspace error - grrr!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 18:13:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-running-geodatabase-compress-as-python/m-p/1034058#M60295</guid>
      <dc:creator>Kara_Shindle</dc:creator>
      <dc:date>2021-03-08T18:13:25Z</dc:date>
    </item>
  </channel>
</rss>

