# Change to directory where script is located abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) os.chdir(dname)