โ01-10-2024 09:12 PM - edited โ01-10-2024 09:14 PM
I am reading a Json a file as in below location, using the below code,
file_path = "/dbfs/mnt/platform-data/temp/ComplexJSON/sample.json" # replace with the file path
f = open(file_path, "r")
print(f.read())
but it is failing for no such file or directory exists?
Can someone please help me with the issue?
โ01-11-2024 08:38 AM
Hi @otum , can you please try to cat the file first and validate if you are able to view the data first
%sh cat /dbfs/FileStore/babynames.csv
I was able to run the same commands as you and read the files.
Thanks,
Shan
โ01-11-2024 03:10 PM
Hello @shan_chandra
it isn't displaying with sh cat, but displaying with dbutils.fs.ls
Please find below is the image,
โ01-11-2024 08:45 AM
Hi, Could you please try with dbfs:/ ? Also, could you please ls the absolute file path to see what's the content?
โ01-11-2024 03:14 PM
โ01-16-2024 07:54 AM
@otum cat command should be given as below (not syntax verified).
%sh cat /dbfs/mnt/platform-data/temp/ComplexJSON/sample.json
โ01-18-2024 10:51 AM
Hi, As Shan mentioned, could you please cat the file and see if it exists.
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group