[Tutor] Spawning terminals from Python - A failed question

Alan Gauld alan.gauld at btinternet.com
Sat Aug 25 00:04:28 CEST 2007


"wormwood_3" <wormwood_3 at yahoo.com> wrote

>  want to basically spawn the process so it keeps running regardless
> of what the script does next (like running something with " &" after 
> it in linux).

Umm, so just put the ampersand at the end of the command string and
call os.system()

> All I ended up having to do was:
>>>> import commands
>>>> commands.getoutput("gnome-terminal")

However both os.system and the commands module are deprecated in 
favour
of the new(ish) subprocess module where the equivalent incantation 
would be:

p = subprocess.Popen("gnome-terminal", shell=True)HTH,-- Alan 
GauldAuthor of the Learn to Program web 
sitehttp://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list