[python-win32] error on shell.SHChangeNotify

Roger Upole rwupole at msn.com
Tue May 22 08:59:10 CEST 2007


TK Soh wrote:
>I am trying to use SHChangeNotify to refresh the icon on the explorer
> windows in the following script, but got an error:
> ----------------------------------
> import sys
> from win32com.shell import shell, shellcon
> 
> def notify(f):
>    shell.SHChangeNotify(shellcon.SHCNE_UPDATEITEM,
>                         shellcon.SHCNF_PATH | shellcon.SHCNF_FLUSHNOWAIT,
>                         f,
>                         None)
> 
> for f in sys.argv[1:]:
>    notify(f)
> ----------------------------------
> 
> Traceback (most recent call last):
>  File "notify.py", line 11, in ?
>    notify(f)
>  File "notify.py", line 8, in notify
>    None)
> TypeError: Only sequences (but not strings) are valid ITEMIDLIST
> objects (got str).
> 
> 
> Does anyone has any idea what I did wrong? I can't find much info on
> google. Thanks

Try a newer build of pywin32.  There was a bug in some older versions
regarding how the function determined whether it needed a file path
or an id list.

          Roger



More information about the Python-win32 mailing list