Reputation: 686
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:\Python3\Python.exe
, C:\Python\Pythonw.exe
, C:\Windows\py.exe
, C:\Windows\pyw.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
Upvotes: 4
Views: 3593
Reputation: 686
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_ROOT\Python.File\Shell\Open
and create a key called "Command
" with
"C:\Windows\py.exe" "%1" %*
as its value. I did the same to CLASSES_ROOT\Applications\py.exe\open\command
Then go to CLASSES_ROOT\Python.File\ShellEx
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?
Upvotes: 2