I’m trying to retrieve a list of files within Foundry using the children method of the Foundry Platform SDK,
as documented here: https://github.com/palantir/foundry-platform-python/blob/develop/docs/v2/Filesystem/Folder.md#children
However, I encounter an error when the folder contains the following files
(removing these files resolves the error):
PDF file
Dashboard
How should I use the children method to retrieve these files?
Or should I be using a different method altogether?
Can you confirm the specific error you see in the Dashboard case? I believe that FOUNDRY_CONTAINER_SERVICE_CONTAINER should be the resource type for a Streamlit / Dash dashboard, so I’m surprised that that case is causing issues.
Since new resource type files will likely be added in the future, I’m planning to output the filename and RID of the file that caused the error and then terminate the process.
Currently, I’m handling errors like this:
try:
for folder in client.filesystem.Folder.children(
folder_rid, preview=preview
):
except Exception as e:
print("Failed to retrieve files under folder: %s\n" % folder.display_name)
print("Type Error: %s\n" % e.__context__)
Failed to retrieve files under folder: FailedFolder
Type Error: 1 validation error for ListChildrenOfFolderResponse data.1.
type Input should be 'AIP_PROFILE', ... , 'WORKSHOP_MODULE' or 'WORKSHOP_STATE' [type=literal_error, input_value='FLOW_WORKFLOW', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/literal_error
I can retrieve the folder name where the error occurred, but is there a way to get the filename and RID of the file that caused the error?
(In this case, the filename and RID of the FLOW_WORKFLOW file).