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

Jim Byrnes jf_byrnes at comcast.net
Wed Jul 9 15:43:49 CEST 2014


On 07/09/2014 04:27 AM, Walter Prins wrote:
> Hi Jim,
>
> On 8 July 2014 21:45, Jim Byrnes <jf_byrnes at comcast.net> wrote:
>
>> I would like to automate running virtualenv with a python script by:
>>
>> opening gnome-terminal
>> cd to proper directory
>> run source /bin/activate
>>
>> I found some examples of using os.system() to get gnome-terminal to open
>> but I can't figure out how then cd to the proper directory in the new
>> terminal.
>>
>> My biggest frustration right now is that I can't find any documentation on
>> how to use os.system().  Looking at the docs on the Python site I don't see
>> system() under the os module.  Googling hasn't helped.
>>
>>
> Could you explain what you're trying to achieve?  Virtualenv is about
> setting up an OS/Unix shell environment (For Windows there's a Powershell
> variant of virtualenv...) so that a custom Python installation is used by
> default instead of the system wide on (including possibly using a custom
> Python executable.)  It therefore seems that trying to automate
> "activating" a virtualenv with python (which presumably would use the
> system wide python) is not adding much value? Hence my question: What are
> you actually trying to achieve?
>
> Walter
>

I forgot to mention I am using Linux (Ubuntu 12.04).

I am working my way through a book about breezypythongui which uses 
Python 3, hence virtualenv.  I found that each time I started to work 
with it I did the above 3 steps, I was just looking to automatic that 
repetitive task.

Regards,  Jim




More information about the Tutor mailing list