<?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: Help with Exit Code 0 issue in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201430#M15492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to zip featureclasses in the geodatabase or shapefiles? I don't see arcpy.ListFeatureclasses anywhere&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Mar 2019 10:34:52 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2019-03-07T10:34:52Z</dc:date>
    <item>
      <title>Help with Exit Code 0 issue</title>
      <link>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201429#M15491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a basic python code that is intended to take the contents of a File GDB and ZIP them (not that actual .gdb itself though). When I test the code it says it's all good. When I run the code however, it goes straight to "Exit Code 0" and nothing happens. No new ZIP file, nothing. Any ideas where I'm going wrong?&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; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; shutil
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; zipfile

&lt;SPAN class="comment token"&gt;# Creates a zip file containing the input shapefile&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#   inFileGDB: Full path to FileGDB folder to be zipped&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#   Delete: Set to True to delete fileGDB files after zip&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Creates a zip file containing the contents of a filegeodatabase&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Zipfgdb&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFileGDB &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'\\my\data\pathway\MyData.gdb'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Delete &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'False'&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;print&lt;/SPAN&gt; inFileGDB &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" : Delete original files = "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; Delete
    &lt;SPAN class="comment token"&gt;#Directory of file geodatabase&lt;/SPAN&gt;
    inLocation &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;dirname &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFileGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"inLocation: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; inLocation
    &lt;SPAN class="comment token"&gt;#Base name of shapefile&lt;/SPAN&gt;
    inName &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;basename &lt;SPAN class="punctuation 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;splitext&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFileGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"inName: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; inName
    &lt;SPAN class="comment token"&gt;#Create the zipfile name &lt;/SPAN&gt;
    zipfl &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;inLocation&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; inName &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;".zip"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"New ZIP file: "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; zipfl
    &lt;SPAN class="comment token"&gt;#Create zipfile object&lt;/SPAN&gt;
    ZIP &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; zipfile&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ZipFile &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;zipfl&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"w"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ZIP file created"&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Iterate files in shapefile directory&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fl &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listdir &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFileGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;#Get full path of file&lt;/SPAN&gt;
        inFile &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;inFileGDB&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="comment token"&gt;#Add file to zipfile. exclude any lock files&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;splitext&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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="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="operator token"&gt;&amp;lt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'lock'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
            ZIP&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;write&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"files added to ZIP file"&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Delete filegeodatabase if indicated&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Delete &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        shutil&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;rmtree&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inFileGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Original file deleted"&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Close zipfile object&lt;/SPAN&gt;
    ZIP&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;close&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;#Return zipfile full path&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; zipfl
&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;/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 10:01:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201429#M15491</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2021-12-11T10:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Exit Code 0 issue</title>
      <link>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201430#M15492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to zip featureclasses in the geodatabase or shapefiles? I don't see arcpy.ListFeatureclasses anywhere&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2019 10:34:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201430#M15492</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-03-07T10:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Exit Code 0 issue</title>
      <link>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201431#M15493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan. Not exactly. The GDB does contain a single feature class, though what this script is intended to do is zip all of the files within a gdb as if you were viewing it through windows explorer (i.e. below). A colleague has helped out and found the solution was with the Return call at the end being incomplete. It should have looked like this [Zipfgdb() as the last line];&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"&gt;#Close zipfile object&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ZIP&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;.&lt;/SPAN&gt;close&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"&gt;#Return zipfile full path&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit; font-size: 14px;"&gt;return&lt;/SPAN&gt; zipfl&lt;/CODE&gt;
Zipfgdb()&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GDB;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/439000_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;ZIP;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/439010_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:01:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201431#M15493</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2021-12-11T10:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Exit Code 0 issue</title>
      <link>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201432#M15494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There wasn't any lock files in there I hope &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2019 00:51:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201432#M15494</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-03-08T00:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Exit Code 0 issue</title>
      <link>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201433#M15495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That ol' chestnut. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt; Thankfully, whoever wrote the sample code I used took that into consideration and they're filtered out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Mar 2019 04:33:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-exit-code-0-issue/m-p/201433#M15495</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2019-03-08T04:33:35Z</dc:date>
    </item>
  </channel>
</rss>

