On Tue, Sep 26, 2017 at 10:38 AM, Kryptxy via Python-list
<python-list@python.org> wrote:
> I want to run a GUI program (transmission-gtk) from python. This is what I do:
>
> import subprocess
> subprocess.Popen(['transmission-gtk', link], stdout=subprocess.PIPE, 
> stderr=subprocess.PIPE)
>
> Where `link` is some magnetic link.
>
> This command opens transmission-gtk, but it haults the calling program, and 
> keeps the terminal busy till the time GUI is running.
> As soon as GUI is closed, the control goes back to the program.
>
> Is there any way that the GUI program is opened, and immediately the control 
> returns to calling program, instead of keeping the terminal busy?
>
> (I know transmission-remote can be used for adding torrents. Looking for a 
> way around for transmission-gtk specifically).

I'm not sure why you can't signal it, but I'll take that parenthesized
comment as an indication that you know about (a) the
transmission-remote command, and/or (b) the fact that transmission-gtk
can be remote-controlled fairly effectively. (For instance, I have a
script that puts Transmission into turtle mode, then does something,
and then takes Transmission out of turtle mode. It's two lines of
shell script to do it.)

So, you want to "fire-and-forget" a GUI program. Or more generally,
_any_ program. My suspicion here is that, since Popen shouldn't be
blocking, that you're filling up one of your pipes. Can you try
removing the stdout and stderr parameters, and see what that does? You
should be able to fire off a subprocess and then carry on with the
program. It might make a lot of noise, if transmission produces a ton
of output; but if that happens, try std{out,err}=subprocess.DEVNULL
instead of PIPE - unless you're specifically trying to read the
output?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to