About FileSelector

hi
i do not understand FileSelector. There is an example in the user guide:

class F(param.Parameterized):
    f = param.FileSelector(path='/usr/share/*')
    fs = param.MultiFileSelector(path='/usr/share/*')
    
f = F()
f.f

f.param.f.objects[0:3]

why f.f is None ? and unlike other parameters, we have to pass by ‘param’ attribute to access to the FileSelector instance ?

thanks

but i call update in the class definition, it works:

class F(param.Parameterized):
    f = param.FileSelector(path='/usr/share/*')
    fs = param.MultiFileSelector(path='/usr/share/*')
   f.update() 
f = F()
f.f

f.f is None because you haven’t chosen any file. Try setting a default options in your class f = param.FileSelector(default="/usr/share/man", path='/usr/share/*').

The f.param.f.objects is the possible options for FileSelector to have based on the path given.

Though, as you have observed this does not match with other parameters like Selector, which returns the first value. For more information see here.

thanks hoxbro
i prefer use update function because i don’t the directory content