<?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: Pyspark will error while I pack source zip package without dir. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27054#M18959</link>
    <description>&lt;P&gt;Hi @pen poon​&amp;nbsp;, could you please refer &lt;A href="https://docs.databricks.com/external-data/zip-files.html" alt="https://docs.databricks.com/external-data/zip-files.html" target="_blank"&gt;https://docs.databricks.com/external-data/zip-files.html&lt;/A&gt; and let us know if this helps? &lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 06:37:17 GMT</pubDate>
    <dc:creator>Debayan</dc:creator>
    <dc:date>2022-10-18T06:37:17Z</dc:date>
    <item>
      <title>Pyspark will error while I pack source zip package without dir.</title>
      <link>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27053#M18958</link>
      <description>&lt;P&gt;If I send the package made by zipfile on spark.submit.pyFiles which zip by this code. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    import zipfile, os
    def make_zip(source_dir, output_filename):
        with zipfile.ZipFile(output_filename, 'w') as zipf:
            pre_len = len(os.path.dirname(source_dir))
            count = 0
            for parent, dirnames, filenames in os.walk(source_dir):
                # if count == 0:  ######I ignore this  will error ####
                #     zipf.write(parent, parent[pre_len:].strip(os.path.sep))
                for filename in filenames:
                    pathfile = os.path.join(parent, filename)
                    arcname = pathfile[pre_len:].strip(os.path.sep)  # path
                    zipf.write(pathfile, arcname)
                else:
                    count = 0
            print(zipf.infolist())&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It will return could not find source error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I to add the path into zip package, it can run success.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 10:30:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27053#M18958</guid>
      <dc:creator>pen</dc:creator>
      <dc:date>2022-10-17T10:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Pyspark will error while I pack source zip package without dir.</title>
      <link>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27055#M18960</link>
      <description>&lt;P&gt;I checked, and your code is ok. If you set source_dir and output_filename please remember to start path with /dbfs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you work on the community edition you can get problems with access to underlying filesystem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 17:15:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27055#M18960</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-20T17:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pyspark will error while I pack source zip package without dir.</title>
      <link>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27054#M18959</link>
      <description>&lt;P&gt;Hi @pen poon​&amp;nbsp;, could you please refer &lt;A href="https://docs.databricks.com/external-data/zip-files.html" alt="https://docs.databricks.com/external-data/zip-files.html" target="_blank"&gt;https://docs.databricks.com/external-data/zip-files.html&lt;/A&gt; and let us know if this helps? &lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 06:37:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pyspark-will-error-while-i-pack-source-zip-package-without-dir/m-p/27054#M18959</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2022-10-18T06:37:17Z</dc:date>
    </item>
  </channel>
</rss>

