Error while reading file from managed folder in webapp

nakul_aggarwal
Level 1
Error while reading file from managed folder in webapp

Hi

I am trying to read a csv file from a managed folder in dash webapp using the following code:

models = dataiku.Folder("LFHBynG2")
folder_path = models.get_path()

df_clearstate = pd.read_excel((os.path.join(folder_path,'Clearstate Data 2008-2020@20211019.xlsx')), sheet_name='Sheet2')

But getting the following error:

 APIErrorException: [Errno 2] No such file or directory: '/data/dataiku/dss_data/managed_folders/MARKET_TRACKER/LFHBynG2/Clearstate Data 2008-2020@20211019.xlsx'

But if I'm trying to do the same thing in notebook, it is working. I'm sure that the file path is correct. I'm not able to understand why this is not working in webapp?

I want to read file from managed folder only since later I have to read some json files and text files for my application.

Thanks

 

0 Kudos
3 Replies
tgb417

@nakul_aggarwal 

Welcome to the Dataiku Community.

In briefly reading your post here.  I find it unusual to use an "at symbol" @ in a filename.  Can you try your setup again with a different file name to see if things will work for you.

Just a thought.  Others do you have a thought for @nakul_aggarwal?

--Tom

--Tom
0 Kudos
nakul_aggarwal
Level 1
Author

Thanks Tom for your response. I have tried the same with a simple file name as well like demo.txt but getting the same error response:

 APIErrorException: [Errno 2] No such file or directory: '/data/dataiku/dss_data/managed_folders/MARKET_TRACKER/LFHBynG2/demo.txt'

Thanks

0 Kudos
tgb417

@nakul_aggarwal 

Got it!  So I'm now wondering three things about your situation.

  1. Is you file on the local file system?  I’m guessing yes. 
  2. Is '/data/dataiku/dss_data/managed_folders/MARKET_TRACKER/LFHBynG2/Clearstate Data 2008-2020@20211019.xlsx'
    the full path to your file? To test you might try.
    1. From the terminal can you
      cd 
      /data/dataiku/dss_data/managed_folders/MARKET_TRACKER/LFHBynG2
    2. Can you then ls Clearstate Data 2008-2020@20211019.xlsx and then see the file.
  3. Does the account that the Dataiku Server is running as have access to this directory and file?  In my case I do know the account that Dataiku is running under and I have root access. So, I sudo su into that account and the try checking out the file above. 

Just a couple of thoughts. Hope they are helpful.  

--Tom
0 Kudos