[Tutor] How can I open and use gnome-terminal from a Python script?

Jim Byrnes jf_byrnes at comcast.net
Sat Jul 12 21:16:38 CEST 2014


On 07/12/2014 01:36 PM, Alan Gauld wrote:
> On 12/07/14 16:34, Jim Byrnes wrote:
>
>> I guess because I don't have the depth of knowledge to know any better.
>> I wanted to automate a tedious process using Python.  I was working with
>> a Python3 version of breezypythongui on a Python2.7 system. So I would
>> open a terminal, cd to the correct directory and run source
>> bin/activate, which would leave me with an open window.
>
> OK, Now imagine you were doing this in (bash) shell - I think you
> are familiar with shell scripts? You wouldn't try to make the shell
> script open a second terminal and then try to inject commands
> into that terminal? You would just run the cd and source commands in the
> shell script within the terminal session you were already
> using, right?
>
> Python is just another scripting tool. You use it the same way. You run
> the script from a terminal so you don't need to open another one, just
> use the one you are in.
>

You're right.  I guess I caused some confusion by stopping short of 
stating my ultimate goal. I wanted a 2 click solution. Open a launcher 
and then click to run the script.  That's why I wanted to open the 
terminal from the script.  When I try to do something I am not sure of I 
usually start simple and once I have something working try to build on 
that. Sorry I didn't state it more clearly sooner, I guess I was too 
caught up in trying to get it to work.

Regards,  Jim



More information about the Tutor mailing list