Skip to content
Advertisement

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

I am trying to open a .txt file using NotePad++ in Python IDE using subprocess.call function. One issue I needed help is that once I execute below codes:
subprocess.call([r"C:Program FilesNotepad++notepad++.exe", r"C:locationmyfile.txt"])
Python won’t start executing other codes untiless I close the Notepad++ program. I have to use Ctrl+C to stop it. What I am trying to do here is to open a file and view it, but I need my code to continue running other functions instead of wait for me to close the NotePad++ program. Does anyone know how to solve it? Thank you!

Advertisement

Answer

This might help: Python-calling-script-without-waiting-for-it-to-execute

You should use

subprocess.Popen

instead of

subprocess.call
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement