On Tue, May 6, 2008 at 9:12 PM, Sizer <[EMAIL PROTECTED]> 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?
I believe the problem is that Windows doesn't view bar.py as an executable file, but as a data file with an associated launcher. It's not smart enough to figure out that when you try to drop a file onto a .py file, you want it to run python.exe with both the .py file and the dropped file as arguments. I don't think there's any way to change this behavior, but I could be mistaken. -- http://mail.python.org/mailman/listinfo/python-list