Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58771
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mail@timgolden.me.uk> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'def': 0.12; '0),': 0.16; 'files:': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'item)': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:programming': 0.16; 'tjg': 0.16; 'wrote:': 0.18; 'import': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'received:192.168.100': 0.24; 'fine': 0.24; 'header:In-Reply- To:1': 0.27; 'raise': 0.29; 'code': 0.31; 'file': 0.32; 'running': 0.33; 'skip:t 40': 0.33; 'subject:with': 0.35; 'skip:s 30': 0.35; 'to:addr:python-list': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'skip:- 60': 0.39; 'skip:p 20': 0.39; 'from:addr:mail': 0.83; 'subject:skip:s 20': 0.91 |
| Date | Fri, 08 Nov 2013 09:47:43 +0000 |
| From | Tim Golden <mail@timgolden.me.uk> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf |
| References | <1b6591af-904c-4a95-8a7b-ee0c63af75db@googlegroups.com> |
| In-Reply-To | <1b6591af-904c-4a95-8a7b-ee0c63af75db@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2200.1383904073.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1383904073 news.xs4all.nl 15995 [2001:888:2000:d::a6]:47318 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:58771 |
Show key headers only | View raw
On 08/11/2013 03:30, iMath wrote:
>
> When running the following code on WinXP , all is fine ,
> --------------------------------------------------------------
> from win32com.shell import shell
>
> def launch_file_explorer(path, files):
>
> folder_pidl = shell.SHILCreateFromPath(path,0)[0]
> desktop = shell.SHGetDesktopFolder()
> shell_folder = desktop.BindToObject(folder_pidl, None,shell.IID_IShellFolder)
> name_to_item_mapping = dict([(desktop.GetDisplayNameOf(item, 0), item) for item in shell_folder])
> to_show = []
> for file in files:
> if file not in name_to_item_mapping:
> raise Exception('File: "{}" not found in "{}"'.format(file, path))
> to_show.append(name_to_item_mapping[file])
> shell.SHOpenFolderAndSelectItems(folder_pidl, to_show, 0)
> import os
>
>
> p=r'E:\aa'
> print(os.listdir(p))
> launch_file_explorer(p, os.listdir(p))
Did you mean to call .GetDisplayNameOf against the desktop folder? I
would have thought you wanted shell_folder.GetDisplayNameOf(item, 0).
TJG
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pywin32 programming error on Win7 with shell.SHGetDesktopFolder,desktop.BindToObject,desktop.GetDisplayNameOf iMath <redstone-cold@163.com> - 2013-11-07 19:30 -0800
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf Tim Golden <mail@timgolden.me.uk> - 2013-11-08 09:47 +0000
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf iMath <redstone-cold@163.com> - 2013-11-08 07:28 -0800
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf iMath <redstone-cold@163.com> - 2013-11-08 07:28 -0800
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf MRAB <python@mrabarnett.plus.com> - 2013-11-08 17:51 +0000
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf iMath <redstone-cold@163.com> - 2013-11-09 21:23 -0800
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder,desktop.BindToObject,desktop.GetDisplayNameOf iMath <redstone-cold@163.com> - 2013-11-10 04:39 -0800
Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder,desktop.BindToObject,desktop.GetDisplayNameOf iMath <redstone-cold@163.com> - 2013-11-10 04:39 -0800
csiph-web