Quantcast
Channel: Ivanovo
Viewing all articles
Browse latest Browse all 85

Run Multiple Terminal Tabs with Python Virtualenv

$
0
0

Virtualenv is a must have for python development.  If your project is complex beast consisting  of multiple services/components you want them see running  in different terminals  (ideally tabs of one terminal window).  Staring all terminal manually could be cumbersome. This simple script starts terminal tabs (in gnome-terminal) with activated virtual environments and eventually appropriate services/applications started:

#!/bin/bash
VENV=".venv/bin/activate"

export PYTHONPATH=~/workspace/asexor

gnome-terminal \
--tab --title "crossbar" -e "bash --rcfile $VENV -ci 'cd asexor && crossbar start'" \
--tab --title "server" -e "bash --rcfile $VENV" \
--tab --title "client" -e "bash --rcfile $VENV" \
--tab --title "terminal" -e "bash --rcfile $VENV"

None -ci argument –  interactive shell must be enforced to run command with virtual environment loaded


Viewing all articles
Browse latest Browse all 85

Trending Articles