cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
cancel
Showing results for 
Search instead for 
Did you mean: 

File not found error when trying to read json file from aws s3 using with open.

Nagarathna
New Contributor II

I am trying to reading json from aws s3 using with open in databricks notebook using shared cluster.

Error message:No such file or directory:'/dbfs/mnt/datalake/input_json_schema.json'

In single instance cluster the above error is not found.

 

 

3 REPLIES 3

artsheiko
Valued Contributor III
Valued Contributor III

Hey,

Please consider to use Unity Catalog with Volumes.

You'll find a quickstart notebook here : https://docs.databricks.com/en/connect/unity-catalog/volumes.html#tutorial-unity-catalog-volumes-not... 

Hope it helps,

Best,

Nagarathna
New Contributor II

Hey,

Thanks for suggesting this approach.

But I want to know why the json file cannot be read from AWS S3 bucket using "with open" in python with shared instance mode cluster. 

The code works perfectly fine if I'm using a single instance mode cluster.

code:

with open("/dbfs/mnt/datalake/input.json","r") as f:

         data = f.read()

NandiniN
Valued Contributor III
Valued Contributor III

Hi @Nagarathna ,

I just tried it on a shared cluster and did not face any issue. What is the exact error that you are facing? Complete stacktrace might help. Just to confirm are you accessing the "/dbfs/mnt/datalake/input.json" from the same workspace when trying out the cluster modes?

Thanks!

Screenshot 2024-05-01 at 15.34.30.png