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