Python拖放损坏 [英] Python Drag-and-drop broken

查看:72
本文介绍了Python拖放损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了pywin(我必须更改注册表项才能执行此操作,但我将其改回了)。我还卸载了Python 2.7,从那时起,我再也无法将文件拖放到我的python脚本上。我也丢失了文件关联。此后,我已经在注册表中卸载,重新安装并运行CCleaner,我尝试将默认程序设置为C:\Python3\Python.exe,C:\Python\Pythonw.exe,C:\Windows\ \py.exe,C:\Windows\pyw.exe,我已经重新启动计算机,但是将文件拖到脚本上仍然无法正常工作。我经历了很多StackOverflow问题,其中大多数来自大约10年前,并且似乎不再相关。有人有什么想法吗?谢谢。

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 poked around in the registry and fixed it by doing the following things (not sure which were necessary and which weren't)

首先,转到HKEY_CLASSES_ROOT.py并确保该值设置为Python.File

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

然后转到HKEY_CLASSES_ROOT\Python.File\Shell\Open并使用

Then go to HKEY_CLASSES_ROOT\Python.File\Shell\Open and create a key called "Command" with

"C:\Windows\py.exe" "%1" %* 

作为其值。我对CLASSES_ROOT\Applications\py.exe\open\命令

as its value. I did the same to CLASSES_ROOT\Applications\py.exe\open\command

做了同样的操作,然后转到CLASSES_ROOT\Python.File\ShellEx并创建了一个

Then go to CLASSES_ROOT\Python.File\ShellEx and create a key called "DropHandler" with

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

作为其值。这个值是DLL的CLSID,它获取您要拖动的文件的文件名并在命令中运行它吗?

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?

这篇关于Python拖放损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆