Can't drag and drop onto .py in Windows XP?

Roger Upole rupole at hotmail.com
Wed May 7 09:08:32 EDT 2008


Sizer wrote:
>I have several python utils that look at sys.argv to get a list of
> filenames to process and mangle the files in various ways. If I have a
> bar.bat file in Windows XP then I can just drag foo.avi onto bar.bat and
> bar.bat gets called with foo.avi as an argument, everyone's happy. But if 
> I
> have a bar.py (or .pyw) and try to drag and drop foo.avi to it, I get a 
> big
> NO cursor and nothing happens.
>
> Now I can work around this by creating a _bar.bat and having the _bar.bat
> call bar.pyw with the filenames it was passed (this is obviously
> ridiculous). Or I can create a shortcut which has the target of
>   c:\python25\pythonw.exe c:\mybar\bar.pyw
> and that works, but makes telling people how to install my utilities on
> their computer a pain in the rear. It's just a little weird that I can't
> just drag and drop file names onto .pyw or .py files. Am I missing
> something here?
>
> Thanks for any help.

You can register a DropHandler for the Python file class.
Put this in a .reg file and merge it into the registry:

REGEDIT4

[HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler]
@="{86C86720-42A0-1069-A2E8-08002B30309D}"


              Roger






More information about the Python-list mailing list