Rick Johnson rantingrickjohnson at
Fri Jul 6 18:17:06 CEST 2012

On Jul 6, 12:22 am, brandon harris <brandon.har... at> wrote:
> [...]
> import tkFileDialog
> # Won't start in or allow navigation to APPDATA
> test = tkFileDialog.askdirectory(initialdir='%APPDATA%')
> # Will start in and navigate to APPDATA
> test = tkFileDialog.askopenfile(initialdir='%APPDATA%')

Don't you just love inconsistencies! I get weird results using your
"string". Why not use expanduser?

py> path = os.path.expanduser('~\\AppData')

Of course that will not solve your main problem though. Probably since
showing hidden files is a function of the OS setting, which explorer
follows blindly. I tried your code AFTER changing "show
hidden_files_and_folders=True" and both dialogs open into the correct
directory, as expected. You could modify the setting, then show the
dialog, then revert the setting back.

Ah. The joys of Win32 scripting... *chokes*

More information about the Python-list mailing list