import os os.chdir("path/to") print os.path.abspath("file") code example Example: python get current file location import os os.path.dirname(os.path.abspath(__file__))