簡體   English   中英

我正在嘗試在notepad ++中設置python,但它無法理解我的文件路徑中是否有空格

[英]I'm trying to set up python in notepad++ and it can't understand my filepath that has a space in it

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

Python 3的示例包括文件夾“ Program Files(x86)”,我認為這不是必需的,但是我仍然想知道如果將來出現此問題時如何解決此問題,而我沒有其他方法做到這一點。

因此,發生的情況是程序假定空格是命令的結尾,並且繼續前進到參數,如下所示:

要運行的程序

錯誤

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)""

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM