faculty.datasets.open

faculty.datasets.open(project_path, mode='r', temp_dir=None, project_id=None, **kwargs)

Open a file from a project’s datasets for reading.

This downloads the file into a temporary directory before opening it, so if your files are very large, this function can take a long time.

Parameters
project_pathstr

The path of the file in the project’s datasets to open.

modestr

The opening mode, either ‘r’ or ‘rb’. This is passed down to the standard python open function. Writing is currently not supported.

temp_dirstr

A directory on the local filesystem where you would like the file to be saved into temporarily. Note that on Faculty servers, the default temporary directory can break with large files, so if your file is upwards of 2GB, it is recommended to specify temp_dir=’/project’.

project_idstr, optional

The project to get files from. You need to have access to this project for it to work. Defaults to the project set by FACULTY_PROJECT_ID in your environment.