Python Drag-and-drop broken

Question:

I recently installed pywin (I had to change a registry entry to do it, but I changed it back). I also uninstalled Python 2.7, and since then, I can no longer drag and drop files onto my python scripts. I also lost my file associations.

I have since uninstalled, reinstalled, run CCleaner on my registry, I’ve tried setting the default program to C:Python3Python.exe, C:PythonPythonw.exe, C:Windowspy.exe, C:Windowspyw.exe, I’ve restarted my computer, but dragging files onto my script still doesn’t work.

I’ve gone through a ton of StackOverflow questions, most of them are from almost 10 years ago and don’t seem to be relevant anymore. Does anyone have any ideas? Thanks.

I also tried this but it didn’t help

Asked By: Jonathan Wilson

||

Answers:

I poked around in the registry and fixed it by doing the following things (not sure which were necessary and which weren’t)

First, go to HKEY_CLASSES_ROOT.py and make sure the value is set to Python.File

Then go to HKEY_CLASSES_ROOTPython.FileShellOpen and create a key called "Command" with

"C:Windowspy.exe" "%1" %* 

as its value. I did the same to CLASSES_ROOTApplicationspy.exeopencommand

Then go to CLASSES_ROOTPython.FileShellEx and create a key called "DropHandler" with

{86C86720-42A0-1069-A2E8-08002B30309D}

as its value. that value is the CLSID of a DLL that gets the filename of the file you’re dragging and runs it in command, I think?

Answered By: Jonathan Wilson