All Collections
Reproducibility and Preservation
Reproducibility
Pros and cons of relative and absolute filepaths
Pros and cons of relative and absolute filepaths

Code Ocean encourages relative filepaths

Shahar Zaks avatar
Written by Shahar Zaks
Updated over a week ago

Getting your code to run on Code Ocean is just like getting it to run on a colleague’s computer; paths that work on your machine, i.e. ~/users/seth/downloads, may not work on theirs. This is why relative filepaths, i.e.  ../data , facilitate reproducibilty. If someone downloads your entire compute capsule and executes your code, a relative filepath will find the data automatically. An absolute path will probably not be recognized.

On the other hand, absolute paths are simpler for authors with complex folder structures. They will be easier to read and understand at a glance.

In general, we encourage but do not require relative paths.

For a more specific how-to guide on using paths on Code Ocean, see this help article.

External Resources: 

Did this answer your question?