Paths are relative by default

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the unix category.

Last Updated: 2022-05-26

I had some Python Jupyter notebook code (stored in ../notebooks) whose job it was to download some images.

These needed to be saved in /storage. I had the following code:

working_folder = Path("storage/hipster-vs-douche")

This, no surprise, ended up saving them to ../notebooks/storage, making a mess.

I had stupidly assumed the code would just "figure out" that I meant an absolute path. This was silly. In fact relative paths are the default, so I should have specified the absolute path as such:

working_folder = Path("/storage/hipster-vs-douche")

Lesson

Paths are relative by default.