It's 10am. You've downloaded a new dataset — it's sitting in your Downloads folder, you can see it in Finder. You open your Jupyter notebook, write pd.read_csv('sales_data.csv'), and run the cell. Python replies:
You just looked at it. It exists. This specific frustration is so common in the data science world it borders on a rite of passage — and it happens because of something most beginner guides skip entirely: the working directory.
Use an absolute path to guarantee Python finds your file every time. Two ways to get it fast: hold Option + right-click on the file in Finder → "Copy [filename] as Pathname" (4 steps, native macOS). Or install Pathly and right-click → "Copy Path" (2 steps, always in the context menu without any modifier key).
Why Mac Paths Confuse Python
There are three separate issues that catch people out. They often layer on top of each other, which makes debugging even harder.
1. The working directory problem
When you write open('sales_data.csv') or pd.read_csv('sales_data.csv'), Python looks for the file relative to the current working directory — the folder Python considers "here" at that moment. It does not look in the folder where your script or notebook lives. It looks where Python was started from.
In a Jupyter notebook, the working directory is wherever you ran jupyter notebook or jupyter lab from in Terminal — which is often your home folder (/Users/yourname) or whatever directory you were in when you launched it. If your notebook lives in /Users/yourname/projects/analysis/ but you launched Jupyter from your home folder, a relative path like 'data/sales.csv' looks for /Users/yourname/data/sales.csv, not /Users/yourname/projects/analysis/data/sales.csv.
To check your actual working directory, run this in a notebook cell:
2. The tilde ~ expansion trap
On Mac, ~ is a shorthand for your home directory. In the Terminal, in Finder's address bar, and in most apps, ~/Downloads/sales.csv expands to /Users/yourname/Downloads/sales.csv automatically.
Python's open() does not automatically expand ~. This fails silently — Python looks for a file or directory literally named ~:
3. Spaces in filenames
Python handles spaces in filenames just fine as long as you quote the path correctly in a string — which you always are, since it's a Python string. The issue arises when you copy a path from Terminal, where spaces are escaped with backslashes: /Users/priya/My\ Documents/sales.csv. If you paste that into a Python string as-is, Python sees the backslash as an escape character and gets confused.
The safest approach: wrap paths that might have spaces in a pathlib.Path() object, or use a raw string r"/Users/priya/My Documents/sales.csv". Note that Pathly copies paths as plain POSIX strings without backslash escaping — correct for Python strings, not for shell commands.
Three Real Patterns Data Scientists Use
Pattern 1: Hardcoded absolute path
The simplest fix. Copy the full absolute path from Finder and paste it directly as a string:
This works every time and is the fastest path from "file in Finder" to "code that runs." The downside: it breaks the moment anyone else opens your notebook, because their home directory is different. It also breaks if you move the file or rename any folder in the path.
Best for: Quick exploratory work on your own machine. Not great for shared notebooks or code you'll run elsewhere.
Pattern 2: pathlib.Path with Path.home()
This is the "correct" software engineering approach. Path.home() returns the current user's home directory on any OS, so the code is portable. The downside: you still have to type the path structure manually. This is great for scripts you write once and reuse; less practical for fast exploratory notebooks where the path changes every session.
Pattern 3: Right-click → Copy Path → paste as absolute string
For exploratory data analysis where you're loading different files every session, the fastest workflow is:
Find the file in Finder
Right-click → Copy Path (with Pathly) or hold Option + right-click → "Copy as Pathname" (native)
In your notebook, type pd.read_csv(' and paste
Close the string with ') and run
The result is an absolute path like /Users/priya/Downloads/sales_q2_final.csv — always correct, regardless of working directory. This is the pattern that actually gets things done during an analysis session.
Jupyter-Specific Tips
A few patterns that specifically help in Jupyter notebooks:
When doing exploratory data analysis for product decisions at Sophinauta — looking at usage patterns, cohort data, that kind of thing — I'm constantly moving files in Finder, finding the right CSV, and feeding paths into Jupyter. I right-click the file in Finder and copy the path with Pathly, paste it as a string directly into the notebook cell. I also do the same when feeding file references to Claude prompts: file:///Users/zura/data/retention_july.csv — Pathly's "Copy as URL" gives me a file:// URL in one extra click that some AI tools and apps can use directly to open the file.
Working with Files That Have Spaces in the Name
If your file is named something like Q2 Sales Data.csv, the spaces are fine in Python — they're just part of the string. What matters is that you don't accidentally include a backslash-escape in the path (those come from Terminal, not from Finder):
Pathly copies the plain POSIX path without backslash escaping, which is correct for use in Python strings. The spaces in the filename are preserved as-is and Python handles them without complaint.
Pathly copies the raw POSIX path. It does not URL-encode spaces as %20, and it does not add backslash escaping. For Python this is exactly what you want. For shell commands in Terminal, you'd still need to quote or escape the path yourself.
Summary: Which Approach for Which Situation
The core insight: absolute paths always work. They're longer and less portable, but for the exploratory, single-machine work that constitutes most data science workflows, they're the pragmatic choice. Get the path from Finder fast, paste, run your code, move on.