簡體   English   中英

使用子進程調用 NotePad++ 后,Python 不會開始執行其他代碼,直到我關閉 Notepad 程序

[英]After calling NotePad++ using subprocess, Python won't start executing other codes until I close the Notepad program

我正在嘗試使用subprocess.call函數在 Python IDE 中使用 NotePad++ 打開一個 .txt 文件。 我需要幫助的一個問題是,一旦我執行以下代碼:
subprocess.call([r"C:\\Program Files\\Notepad++\\notepad++.exe", r"C:\\location\\myfile.txt"])
除非我關閉 Notepad++ 程序,否則 Python 不會開始執行其他代碼。 我必須使用 Ctrl+C 來停止它。 我在這里嘗試做的是打開一個文件並查看它,但我需要我的代碼繼續運行其他功能,而不是等待我關閉 NotePad++ 程序。 有誰知道如何解決它? 謝謝!

這可能會有所幫助: Python-calling-script-without-waiting-for-it-to-execute

你應該使用

subprocess.Popen

代替

subprocess.call

暫無
暫無

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

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