[Tutor] How can I open and use gnome-terminal from a Python script?
Cameron Simpson
cs at zip.com.au
Wed Jul 9 07:14:14 CEST 2014
On 09Jul2014 11:42, Steven D'Aprano <steve at pearwood.info> wrote:
>On Tue, Jul 08, 2014 at 03:45:42PM -0500, Jim Byrnes wrote:
>> I would like to automate running virtualenv with a python script by:
>>
>> opening gnome-terminal
>> cd to proper directory
>> run source /bin/activate
>
>Why not just run /bin/activate directly from Python?
>
>os.chdir("the/proper/directory")
>os.system("/bin/activate")
Because "activate" needs to be sourced by the shell. It hacks the environment.
Cheers,
Cameron Simpson <cs at zip.com.au>
If at first you don't succeed, your sky-diving days are over.
- Paul Blumstein, paulb at harley.tti.com, DoD #36
More information about the Tutor
mailing list