In R and R Studio I use relative paths to load data files. This makes the code runnable on anybody else's computer, and hence makes my research reproducible.
To do the same in Python, I have tried using os.path.dirname(__file__)
to get the path of my script, but the interpreter does not recognize __file__
.
__file__
" what does that mean exactly? What exactly are you doing? How are you running Python?