msg59547 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2008-01-08 17:12 |
The new module "winpath" gives easy access to Windows shell folders like my documents, my files, application data etc. |
|
|
msg59549 - (view) |
Author: Raghuram Devarakonda (draghuram)  |
Date: 2008-01-08 17:55 |
The current 'path' modules such as posixpath and ntpath have functions that operate on a file path. But I see this module more as a way of getting information related to one's profile. So the name 'winpath' may not be a good choice. |
|
|
msg59551 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2008-01-08 18:04 |
I'm not very good in naming things. I'm open to suggestions :) |
|
|
msg59553 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2008-01-08 18:56 |
I believe Microsoft advises against looking at the registry to find these things, and advocates the use of SHGetFolder instead: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/apcompat/apcompat/use_the_application_programming_interface_to_locate_special_folders.asp As for naming things: I guess an object ShellFolders in ntpath might work fine, with (computed) attributes Desktop, Documents, etc (according to the FOLDERID_ symbolic constants of the API). OTOH, this is entirely ad-hoc, as tons of other Windows API is *not* directly exposed to Python, so it's questionable why this one specifically deserves being supported. The patch has no documentation. |
|
|
msg59567 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2008-01-08 22:26 |
Here is a new patch which adds os.path.getshellfolders(). It uses SHGetFolderPathW which is compatible with Windows 2000. I've implemented the API because several of my project need the path to my documents. I've a personal interested in the specific feature. It may also be required for a new, user specific site-package directory. The feature is currently being discussed on the python-dev list. |
|
|
msg59584 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2008-01-09 09:05 |
> It uses SHGetFolderPathW which is compatible with Windows 2000. Is Python supposed to still work on Windows NT 4? http://svn.python.org/projects/python/trunk/README says that support will be droppen in 2.6 for Win9x and WinME, but says nothing about NT4. OTOH, the msdn library site removed many references to NT4 (see the doc for CreateFile, for example). It could be wise to say that python 2.6 is supported only on Windows 2000 and up. |
|
|
msg59585 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2008-01-09 09:18 |
It was never explicitly discussed, however, I always assumed that NT4 support is not necessary anymore. I would like to pose a policy that Python does not need to support Windows releases which have left Microsoft's "extended support". For NT 4 WS, this was on 30.6.2004. For Windows 2000 Pro, this will be on 13.7.2010. Of course, *testing* the releases on Windows 2000 will become difficult - I don't have access to Windows 2000 installations anymore. |
|
|
msg59586 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2008-01-09 09:52 |
OK. We should also remove references to older versions on the website: http://www.python.org/download/releases/2.5.1/ and the various READMEs. For testing older platforms, we can still use virtual machines. I think this is how Christian develops on Windows XP. |
|
|
msg59599 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2008-01-09 14:00 |
Amaury Forgeot d'Arc wrote: > For testing older platforms, we can still use virtual machines. I think > this is how Christian develops on Windows XP. Correct, I'm using a VMWare installation of Windows XP SP2 German and DesktopBSD (FreeBSD variant) to test Python on Windows and BSD. Several of the build bots seem to use a VMWare installation, too. Christian |
|
|
msg59617 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2008-01-09 18:44 |
> OK. We should also remove references to older versions on the website: > http://www.python.org/download/releases/2.5.1/ and the various READMEs. No. Python 2.5.1 *does* support Windows 95 (I have myself tested that). Only 2.6 will drop support for 9x. |
|
|
msg60076 - (view) |
Author: Mark Hammond (mhammond) *  |
Date: 2008-01-18 00:01 |
I'm not sure why the approach of "load-em-all" is being taken. Interestingly, SHGetFolderPathW is listed as deprecated, so I doubt that list will grow too much, but the implementation as specified prevents the user from using other facilities available via the API (ie, what if they *do* want it verified? What if they want to specify CSIDL_FLAG_CREATE?) That said though, I don't object to the patch as it stands, and agree it will meet the requirements of the majority of people who need a "known path" on Windows. |
|
|
msg60082 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2008-01-18 08:07 |
Mark Hammond wrote: > I'm not sure why the approach of "load-em-all" is being taken. > Interestingly, SHGetFolderPathW is listed as deprecated, so I doubt that > list will grow too much, but the implementation as specified prevents > the user from using other facilities available via the API (ie, what if > they *do* want it verified? What if they want to specify > CSIDL_FLAG_CREATE?) > > That said though, I don't object to the patch as it stands, and agree it > will meet the requirements of the majority of people who need a "known > path" on Windows. Indeed, the patch targets the most basic requirements. I wanted to implement a simple and straight solution without implementing a complex API or adding about 30 new constants to a module. Users with extend needs should use your pywin32 package. I don't feel like rewriting your package here. ;) |
|
|
msg62242 - (view) |
Author: Hirokazu Yamamoto (ocean-city) *  |
Date: 2008-02-10 02:12 |
Sorry for interruption. I'm a little doubtful this is really needed. We can get "My Documents" path by following 5 lines of code. import ctypes dll = ctypes.windll.shell32 buf = ctypes.create_string_buffer(300) dll.SHGetSpecialFolderPathA(None, buf, 0x0005, False) print buf.value And if this patch goes in, I'm using clipboard in my several python scripts, is it also possible to add clipboard support? (I implemented ocean/clipboard.py under PYTHONPATH and now using it personally) # And, well, r60696 blocks me from building python on VC6, if this change # (WINVER = 0x500) is required for this issue only, I'm happy if this # would be reverted but... I cannot claim it loudly. I'm using win2000, # and latest free compiler doesn't support it :-( |
|
|
msg62277 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) *  |
Date: 2008-02-11 10:52 |
> I'm using win2000, and latest free compiler doesn't support it :-( I hope it does. r60696 is only about supporting win2000 when compiled with vs9. Building with vc6 should be corrected. I filed . |
|
|
msg110596 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-07-17 19:08 |
@Christian: have you any interest in keeping this open or can it be closed, gien that the last comment was 2 1/2 years ago? |
|
|
msg116859 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-09-19 10:52 |
No reply to . |
|
|
msg191760 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-24 13:16 |
Oh my, this patch is rather ancient. Is this feature still of interest? I'm happy to port it from 2.6 to 3.4. |
|
|
msg191767 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2013-06-24 14:28 |
See also PyXDG (http://freedesktop.org/wiki/Software/pyxdg/) and winpaths (http://ginstrom.com/code/winpaths.html). |
|
|
msg191787 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2013-06-24 17:01 |
Here is a patch that returns the paths of all known SHGetKnownFolderPath() and SHGetFolderPath(). SHGetKnownFolderPath() is currently not available for Python 3.4 as Python 3.4 still uses Windows XP API but SHGetKnownFolderPath() requires Vista or newer. http://msdn.microsoft.com/en-us/library/windows/desktop/bb776911%28v=vs.85%29.aspx |
|
|
msg232979 - (view) |
Author: Jason R. Coombs (jaraco) *  |
Date: 2014-12-20 19:17 |
+1 from me for supporting this functionality in Python natively. I tried winpaths but it doesn't yet support Python 3. I've e-mailed the author so it might be considered for a future release. |
|
|