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

Tony Nelson *firstname*nlsnews at georgea*lastname*.com
Fri Nov 18 06:29:25 CET 2005


In article <1132291524.456686.314640 at o13g2000cwo.googlegroups.com>,
 jim.mccoy at gmail.com wrote:

> 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...

Sounds good, thanks.  I'll read up on it all tomorrow.
________________________________________________________________________
TonyN.:'                        *firstname*nlsnews at georgea*lastname*.com
      '                                  <http://www.georgeanelson.com/>



More information about the Python-list mailing list