Thanks for the code Tom. Unforunately, I get the following error message when trying to import win32com in idle:
>>> from win32com.shell import shell, shellcon Traceback (most recent call last): File "<pyshell#20>", line 1, in -toplevel- from win32com.shell import shell, shellcon ImportError: No module named win32com.shell Tim Golden wrote: > [Dan Bishop] > | flamesrock wrote: > | > Hi, > | > > | > Short, maybe newbish question: Is there a python method for finding > | out > | > who the current user is in the OS module? > | > > | > On older windows machines the directory I'm interested in is just > | > "c://my documents", but how do I walk to the current users my > | documents > | > folder? > | > | path = '%s\\My Documents' % os.environ['USERPROFILE'] > > Or, rather more generally: > > <code> > > from win32com.shell import shell, shellcon > import win32api > > # > # Don't need this to find the right folder, > # but since you asked... > # > print win32api.GetUserName () > > # > # This is the "personal files" which usually corresponds > # to the "My Documents" folder, but in my case points to > # h:\ since that's my home folder in my AD profile. > # > print shell.SHGetPathFromIDList ( > shell.SHGetSpecialFolderLocation (0, shellcon.CSIDL_PERSONAL) > ) > > # > # To see a list of possible CSIDL values: > # > for i in dir (shellcon): > if i.startswith ("CSIDL"): > print i > > </code> > > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star. The > service is powered by MessageLabs. For more information on a proactive > anti-virus service working around the clock, around the globe, visit: > http://www.star.net.uk > ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list