managed folder issue

Level 3
managed folder issue

Hi Team,

I am following

i am stuck with cell no. 4 , as i have 2 folders named "Train" and "Test"

In "Train" there are 2 more folders named "def_front" and "OK_front".

so i am using below code as:

import dataiku
files = ['def_front', 'ok_front']
adress = dataiku.Folder("b7SXqJ56")
data_train = {}
for f in files:
for col in files:
for i in os.listdir(os.getcwd()):
if i.endswith('.jpeg'):


and i am getting error like:

<ipython-input-6-db47d71d890e> in <module>
7 data_train[f]=[]
8 for col in files:
----> 9 os.chdir(adress.format(col))
10 for i in os.listdir(os.getcwd()):
11 if i.endswith('.jpeg'):

AttributeError: 'folder' object has no attribute 'format'


kindly help to resolve this issue


0 Kudos
3 Replies

The error "AttributeError: 'folder' object has no attribute 'format'"  is due "adress" is an object that does have the attribute format,.

You would need to use:

adress = dataiku.Folder("local_models").get_path()

Instead to get the path actual path. Let me know if this is what you were trying to do. 

Screenshot 2021-07-28 at 17.40.41.png

0 Kudos
Level 3

Thanks Alex for your quick answer,

We have dataset hierarchy as follows:


Train and Test are 2 folders and inside we have 2 more folders in each named Def_front & Ok_front

and in def_front and ok_front , there are 2-3k .jpng files.

we want to access them how can we do that with above code


0 Kudos


As far as I saw the code sample you shared will will list the file in the root directory and the subdirectories but not contents of the subdirectories.

You can have a look at sample provided here which will list all files and you can filter by the subdirectories and .jpeg as needed. 

0 Kudos