<?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: How to unpack .tar.gz files with Python? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48617#M3865</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just replaced: tarfile.TarFile(...&lt;/P&gt;&lt;P&gt;for: tarfile.open(...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2017-01-30 16:43 GMT-03:00 Curtis Price &amp;lt;geonet@esri.com&amp;gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;GeoNet &amp;lt;https://community.esri.com/?et=watches.email.thread&amp;gt;&lt;/P&gt;&lt;P&gt;Re: How to unpack .tar.gz files with Python?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply from Curtis Price&lt;/P&gt;&lt;P&gt;&amp;lt;https://community.esri.com/people/curtvprice?et=watches.email.thread&amp;gt; in&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Python&lt;/STRONG&gt; - View the full discussion&lt;/P&gt;&lt;P&gt;&amp;lt;https://community.esri.com/message/662700-re-how-to-unpack-targz-files-with-python?commentID=662700&amp;amp;et=watches.email.thread#comment-662700&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jan 2017 21:23:10 GMT</pubDate>
    <dc:creator>BrunoDeus1</dc:creator>
    <dc:date>2017-01-30T21:23:10Z</dc:date>
    <item>
      <title>How to unpack .tar.gz files with Python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48615#M3863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;I would like do the same thing to multiple Giz and Tarfiles. I already replaced "zipfile" for "tarfile" at the script, but It doesn't works with Python 2.7.1 at ArcMap 10.1 (but will be good which It works with newer ArcMap)&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; &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; tarfile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fnmatch&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;os
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; rootPath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Teste_Auto_Unzip"&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; pattern &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'*.tar.gz'&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&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;for&lt;/SPAN&gt; root&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; dirs&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; files &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;walk&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rootPath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; filename &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fnmatch&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;filter&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;files&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; pattern&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&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;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;root&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tarfile&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TarFile&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;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;root&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extractall&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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;root&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&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="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="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt; 
C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\Teste_Auto_Unzip\LC82270692015242LGN00&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;tar&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gz
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;7&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:\Python27\ArcGIS10.4\Lib\tarfile.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1581&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; __init__
self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;firstmember &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; self&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;next&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;"C:\Python27\ArcGIS10.4\Lib\tarfile.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;2356&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; next
&lt;SPAN class="keyword token"&gt;raise&lt;/SPAN&gt; ReadError&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;e&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
ReadError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; invalid header‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:52:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48615#M3863</guid>
      <dc:creator>BrunoDeus1</dc:creator>
      <dc:date>2021-12-10T21:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to unpack .tar.gz files with Python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48616#M3864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The doc says, and it is a good idea, as the open() method allows you to specify .tar.gz format:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Do not use this class directly, better use tarfile.open() instead&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.python.org/2/library/tarfile.html" title="https://docs.python.org/2/library/tarfile.html"&gt;12.5. tarfile — Read and write tar archive files — Python 2.7.13 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2017 19:42:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48616#M3864</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-01-30T19:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to unpack .tar.gz files with Python?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48617#M3865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just replaced: tarfile.TarFile(...&lt;/P&gt;&lt;P&gt;for: tarfile.open(...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2017-01-30 16:43 GMT-03:00 Curtis Price &amp;lt;geonet@esri.com&amp;gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;GeoNet &amp;lt;https://community.esri.com/?et=watches.email.thread&amp;gt;&lt;/P&gt;&lt;P&gt;Re: How to unpack .tar.gz files with Python?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply from Curtis Price&lt;/P&gt;&lt;P&gt;&amp;lt;https://community.esri.com/people/curtvprice?et=watches.email.thread&amp;gt; in&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Python&lt;/STRONG&gt; - View the full discussion&lt;/P&gt;&lt;P&gt;&amp;lt;https://community.esri.com/message/662700-re-how-to-unpack-targz-files-with-python?commentID=662700&amp;amp;et=watches.email.thread#comment-662700&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jan 2017 21:23:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-unpack-tar-gz-files-with-python/m-p/48617#M3865</guid>
      <dc:creator>BrunoDeus1</dc:creator>
      <dc:date>2017-01-30T21:23:10Z</dc:date>
    </item>
  </channel>
</rss>

