python - 我正在尝试在 notepad++ 中设置 python,但它无法理解我的文件路径中包含空格

标签 python configuration notepad++ filepath

我正在使用本教程:https://silentcrash.com/2016/12/run-python-script-notepad/

Python 3 的示例包括文件夹“Program Files (x86)”,我认为这不是必需的,但我仍然想知道如果将来出现此问题如何解决,但我不这样做还有另一种方法。

因此,程序假设空格是命令的结尾,然后继续执行参数,如下所示:

The Program to Run

Error

The system cannot find the file specified.
An attempt was made to execute the below command.
------------------------------------------------
Command: C:\Program
Arguments: Files\Python37\Lib\idlelib.py "new 2"
Error Code: 2

有什么方法可以写文件路径,使其不会像这样被分割吗?

最佳答案

当参数包含空格时,您需要用引号引起来。在您的示例中,您将在“运行...”对话框中使用以下命令:

"C:\Program Files\Python37\Lib\idlelib.py" "$(FULL_CURRENT_PATH)"

我在 superuser.com 上找到了有用的提示当脚本完成时,这将阻止控制台窗口关闭。但是,请注意,它现在需要一组额外的引号。

cmd /k ""C:\Program Files\Python37\Lib\idlelib.py" "$(FULL_CURRENT_PATH)""

关于python - 我正在尝试在 notepad++ 中设置 python,但它无法理解我的文件路径中包含空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54432165/

相关文章:

python - Django 模型继承 : ForeignKey on parent, 没有对子模型的 related_name 访问

python - 在类实例中第二次导入

postgresql - PostgreSQL 安装的配置建议

json - 有什么方法可以在运行时使用 webpack 加载资源?

regex - 匹配之间的所有内容但排除单词 - notepad++

append - 使用 Notepad++ 和 Regex 将文本添加到每个文件的末尾

python - undefined symbol : __atomic_fetch_add_8

python - 在产品存储库或外部存储库中构建/部署脚本?

正则表达式 - 跳过前 12 个字符

python - 安装 python mptt 权限被拒绝