How do I get this drag-and-drop behaviour back?

1

0

I just (finally!) upgraded Python from 2.6 to 2.7, and also installed 3.2 in parallel. I am running Windows Vista.

Before, I could drag-and-drop onto a .py file to run the script, with the dragged file's name appearing in sys.argv. I did nothing to get this behaviour; it worked as soon as Python 2.6 was installed.

It no longer works: the .py file is not recognized as a valid drop target.

I tried this registry hack, which I also found by searching on Google (getting a few scattered references, including an old mailing list thread on python.org). It accomplished exactly nothing, even after restarting the computer. I also shouldn't have to do this anyway, since I didn't have to last time.

What is going on? How can I fix it? I really miss having this behaviour.

Karl Knechtel

Posted 2011-12-08T01:10:43.147

Reputation: 61

What did you drag and drop onto the .py? – Paul – 2011-12-08T01:47:51.253

A plain text file, which the .py is meant to open and read. Previously, the path to the dropped file was supplied in sys.argv. – Karl Knechtel – 2011-12-08T02:25:12.890

If you drop text files in a .exe icon, does it run the .exe? People were probably using this as an attack vector and so Microsoft decided to remove the feature in some update. – gcb – 2011-12-10T05:23:20.527

drag-and-drop to an .exe works fine. I haven't heard of any such lockdown, either. – Karl Knechtel – 2011-12-13T19:20:07.753

Answers

0

Is it possible that this is a bitness problem, where you are using a 64-bit Explorer, but have installed the 32-bit version of python ? In this case the 64-bit Explorer may not work.

If you have installed Windows 64-bit, you can still test this theory by dropping a file on a .py script using the 32-bit Explorer, which is invoked using this command-line :

%Systemroot%\SysWOW64\explorer.exe /separate

[EDIT]

Since you say that this is not the case, then I can only offer as workaround to compile the .py scripts to .exe by using a tool such as py2exe :

py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

Question: Did you install python using its installer ?

harrymc

Posted 2011-12-08T01:10:43.147

Reputation: 306 093

No, I have 32-bit Vista and got the 32-bit Python install (would the 64-bit one even work?). I do not have a SysWOW64 folder in my %Systemroot%. – Karl Knechtel – 2011-12-11T16:21:19.497

Yes, Python was installed using the official MSI installer from python.org, the same as I did last time with 2.6. – Karl Knechtel – 2011-12-16T04:06:52.180

Then this is a problem with the installer that you should raise with the python developers on their forum. Until it is fixed, the only workaround I can offer is using py2exe. – harrymc – 2011-12-16T12:19:03.330