Antonio
Antonio

Reputation: 59

App doesn't respond when use Subprocess call

My app doesn't respond when I use subprocess.call(['notepad.exe', path]) Does anyone know the reason for this?

(notepad opens the file in path correctly)

Open a text file using notepad as a help file in python?

Upvotes: 0

Views: 136

Answers (1)

ForceBru
ForceBru

Reputation: 44888

You're running this on the thread that's responsible for GUI. The call to subprocess.call returns only when the called program terminates. While it's still running, the function just sits there and waits, so your GUI is forced to wait as well.

To avoid this, run this function in another thread or use a non-blocking cousin of subprocess.call.

Upvotes: 1

Related Questions