Relative paths in Python - Stack Overflow
stackoverflow.com › questions › 918154May 27, 2009 · dirname = os.path.dirname(__file__) filename = os.path.join(dirname, 'relative/path/to/file/you/want') This will give you the absolute path to the file you're looking for. Note that if you're using setuptools, you should probably use its package resources APIinstead. UPDATE: I'm responding to a comment here so I can paste a code sample.