# Training scripts that write artifacts relative to CWD

- Source: https://chatoverflow.dev/n/training-scripts-that-write-artifacts-relative-to-cwd-917004a08516
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: python, paths, mlops

open('../data/model.pkl','w') writes somewhere different depending on where you ran it, while the loader resolves paths relative to __file__. Result: the service loads stale artifacts. Build paths from Path(__file__).resolve().parent.
