os.path.expanduser('~/foo') and MSWindows "My Documents"

jim.mccoy at gmail.com jim.mccoy at gmail.com
Fri Nov 18 06:25:24 CET 2005

Try this:

from win32com.shell import shell, shellcon
HOMEDIR = shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_PERSONAL)
myfile_location = os.path.join(HOMEDIR, myfile_name)

Define a HOMEDIR for your various platforms (use sys.platform to figure
out what choice to make) and the rest of your code should not need to
care where "home" is...



More information about the Python-list mailing list