<?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: Getting the error 'No such file or directory', when trying to access the json file in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19855#M13382</link>
    <description>&lt;P&gt;So open_by_key is a function of gspread, which is a python lib.&lt;/P&gt;&lt;P&gt;Pure python (not pyspark) will only read from local files,&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.databricks.com/s/question/0D53f00001HKHuwCAH/read-file-from-dbfs-with-pdreadcsv-using-databricksconnect" alt="https://community.databricks.com/s/question/0D53f00001HKHuwCAH/read-file-from-dbfs-with-pdreadcsv-using-databricksconnect" target="_blank"&gt;see this topic also&lt;/A&gt;. It is about databricks-connect and pandas but the same principles apply.&lt;/P&gt;</description>
    <pubDate>Wed, 25 May 2022 07:14:24 GMT</pubDate>
    <dc:creator>-werners-</dc:creator>
    <dc:date>2022-05-25T07:14:24Z</dc:date>
    <item>
      <title>Getting the error 'No such file or directory', when trying to access the json file</title>
      <link>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19854#M13381</link>
      <description>&lt;P&gt;I am trying to write in my google sheet through Databricks but when it comes to reading the json, file containing the credentials, I am getting the error that No such file or directory exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import gspread
&amp;nbsp;
&amp;nbsp;
gc = gspread.service_account(filename='dbfs:/FileStore/shared_uploads/abc@gmail.com/myapi_3115465_2ed05-3.json')
&amp;nbsp;
sh = gc.open_by_key('1********_g3kkhhA_9vMyp9piw')
&amp;nbsp;
worksheet = sh.sheet1
&amp;nbsp;
worksheet.update_cell(1,1,103032)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Getting the following error when I run the above code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FileNotFoundError: [Errno 2] No such file or directory: 'dbfs:/FileStore/shared_uploads/abc@gmail.com/myapi_3115465_2ed05-3.json'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 05:47:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19854#M13381</guid>
      <dc:creator>Devarsh</dc:creator>
      <dc:date>2022-05-24T05:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the error 'No such file or directory', when trying to access the json file</title>
      <link>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19855#M13382</link>
      <description>&lt;P&gt;So open_by_key is a function of gspread, which is a python lib.&lt;/P&gt;&lt;P&gt;Pure python (not pyspark) will only read from local files,&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.databricks.com/s/question/0D53f00001HKHuwCAH/read-file-from-dbfs-with-pdreadcsv-using-databricksconnect" alt="https://community.databricks.com/s/question/0D53f00001HKHuwCAH/read-file-from-dbfs-with-pdreadcsv-using-databricksconnect" target="_blank"&gt;see this topic also&lt;/A&gt;. It is about databricks-connect and pandas but the same principles apply.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 07:14:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19855#M13382</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2022-05-25T07:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the error 'No such file or directory', when trying to access the json file</title>
      <link>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19856#M13383</link>
      <description>&lt;P&gt;Yes @Werner Stinckens​, I tried different ways to read the json file from the path where it was stored but was unable to do so. Instead of this what I have done is that I have copied the content of the JSON file in a variable and passed that to the following function&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;credentials = {"type":"service_account","project_id":"myapi-.................}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;gc = gspread.service_account_from_dict(credentials)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So now no need to read from any json file&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 09:23:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19856#M13383</guid>
      <dc:creator>Devarsh</dc:creator>
      <dc:date>2022-05-25T09:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the error 'No such file or directory', when trying to access the json file</title>
      <link>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19857#M13384</link>
      <description>&lt;P&gt;Hi @Devarsh Shah​&amp;nbsp;The issue is not with json file but the location you are specifying while reading.As suggested by @Werner Stinckens​&amp;nbsp;please start using spark API to read the json file as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;spark.read.format("json").load("testjson")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the path you are providing in the read command if you still face the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/data/data-sources/read-json.html" target="test_blank"&gt;https://docs.databricks.com/data/data-sources/read-json.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 03:57:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/getting-the-error-no-such-file-or-directory-when-trying-to/m-p/19857#M13384</guid>
      <dc:creator>Noopur_Nigam</dc:creator>
      <dc:date>2022-06-02T03:57:45Z</dc:date>
    </item>
  </channel>
</rss>

