I have external data input that I use in my python scripts (in fact an excel file as a template). This external file is specific to the version of the script that I check in to SVN. So I suppose I should check in the external file as well?
How would you manage that the script finds the file (I use Windows)? A relative path to the current directory? Checking sys.path paths manually? Some parameter given to the script which specifies the root directory of relative path accesses?
A common idiom for finding data files is this:
So if your script lives in
/some/path/script.py, anddata_filenameismyfile, this will correctly find/some/path/myfilewhen your script is executed.This works on Windows as well as Linux