Running a GUI program haults the calling program (linux)

Cameron Simpson cs at cskk.id.au
Tue Sep 26 05:45:07 EDT 2017


On 26Sep2017 04:48, Kryptxy <kryptxy at protonmail.com> wrote:
>>> Here -
>>>
>>> p = subprocess.Popen(["transmission-gtk", link], stdout=subprocess.PIPE,
>>> stderr=subprocess.PIPE)
>>> output, error = p.communicate()

Peter> That"s the problem. communicate() *must* block to collect the program"s
Peter> entire output. You get what you ask for...

>Thanks! It worked!

If you just removed the .communicate() call then you're not waiting for the 
process to exit, or collection its output. Don't attach stdout or stderr to 
pipes if you aren't going to collect them. If you attach them to pipes and 
don't read them then the pipes can fill, stalling the app.

Cheers,
Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)




More information about the Python-list mailing list