Permissions Denied error

Mingyan
Mingyan Registered Posts: 3
edited July 16 in Setup & Configuration

I want to read a docx file in my dataiku folder through python recipes, but it returns permission denied. How can I change my folder access permissions?

# Read recipe inputs
Dataset_folder = dataiku.Folder("DYV5ukXU")
folder = Dataset_folder.get_info()
doc_path = os.path.join(folder["path"], "GDMS005_001.docx")

f = open(doc_path)

---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
<ipython-input-4-da12e1b887da> in <cell line: 1>()
----> 1 f = open(doc_path)

PermissionError: [Errno 13] Permission denied: '/data/dataiku/dss_data/managed_folders/TUMING/DYV5ukXU/GDMS005_001.docx'

Operating system used: Windows 11

Best Answer

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
    Answer ✓

    Hi,
    To use the absolute path for the managed folder without getting permission error you need to meet the following conditions

    1) You must run the job/recipe locally not in a container. If you use a container you must use the remote managed folder option get_download/upload_stream.

    2) You must use get_path() API call to set appropriate ACLs and permission before being to call the path using "os" package. You can try something like this:

    Dataset_folder = dataiku.Folder("DYV5ukXU")
    folder = Dataset_folder.get_info()

    path = folder.get_path()
    doc_path = os.path.join(path, "GDMS005_001.docx")


    https://developer.dataiku.com/latest/concepts-and-examples/managed-folders.html#detailed-examples

    Thanks

Setup Info
    Tags
      Help me…