This is the standard operating system library.
Getting:
os.getenv('MY_VAR')
Setting:
os.putenv('MY_VAR', 'foo')
This gets the directory of the current file
path = os.path.dirname(os.path.abspath(__file__))
This gets the current directory of the execution context. So, if this code is in a module in a sub directory and we import it into a script that we run, it will not report the directory of the file the code is in. It will report the directory of the script that's getting executed.
import os
path = os.getcwd()