When programming in python, you sometimes need to access a path off your project root from deep in another directory hierarchy. Here is a really easy way to do it that always works:

import sys
print(sys.path[1])

 This way, you can use relative paths from the python file to get  to your configuration files, data files, and secrets files. But do make sure you are not pushing your secrets to GitHib and other online repos! 

Share This