Try using os.chdir() before opening the file:
os.chdir()
import os os.chdir(r"C:\Users\Documents\") f = open("blight.txt", "a") f.write("suppress this later") f.close()