cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
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
Honored Contributor
Honored Contributor

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

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!