I'm doing a simple program that moves files, and I'm having it pull the file paths from a text document so it doesn't have to be inputed every time.
Here's the function for one of the buttons:
def XboxClick():
pathfinder = open("settings.txt", "r")
xboxsavepath = pathfinder.readline()
steamsavepath = pathfinder.readline()
pathfinder.close
#lbl.configure(text=xboxsavepath)
xboxsavefile = filedialog.askopenfilename(title="Select the Xbox save", initialdir=xboxsavepath)
In the text document, this row is C:/Users/username/AppData/Local/Packages/
.
The commented out line #lbl.configure(text=xboxsavepath)
will return C:/Users/username/AppData/Local/Packages/
.
If I do:
xboxsavefile = filedialog.askopenfilename(title="Select the Xbox save", initialdir='C:/Users/username/AppData/Local/Packages/')
It will open the file window at that directory.
However, when using the variable xboxsavepath
, which uses the exact same string, it just opens the file window to the default. I don't know why.
Hopefully that's enough info.