Hi!
I have been carrying out a POC, so I created the CSV file in my workspace and tried to read the content using the techniques below in a Python notebook, but did not work.
Option1:
repo_file = "/Workspace/Users/u1@org.com/csv files/f1.csv"
tmp_file_name = file_name.replace(".","").replace("/","").replace(" ","")
file_location = f"/FileStore/tmp/{tmp_file_name}"
dbutils.fs.rm("/FileStore/tmp/", True)
dbutils.fs.mkdirs("/FileStore/tmp/")
shutil.copyfile(repo_file, f"/dbfs{file_location}")
Option2:
repo_file = "/Workspace/Users/u1@org.com/csv files/f1.csv"
tmp_file_name = file_name.replace(".","").replace("/","").replace(" ","")
file_location = f"/FileStore/tmp/{tmp_file_name}"
dbutils.fs.rm("/FileStore/tmp/", True)
dbutils.fs.mkdirs("/FileStore/tmp/")
dbutils.fs.cp(repo_file, f"/dbfs{file_location}")
Both the options throw the same exception java.io.FileNotFoundException. I realized problem is with the source file path. Above code works fine, if I try to read the file from repos instead of my workspace.
As an alternative, I uploaded the CSV file into a blob storage account and able to read it without any issues.
I am curious to find as I believe there must be a way to read the CSV file from my work space aswell.
I would be glad if you can post here how to do so?
Thanks!