title: Running subprocess within different virtualenv with python
body: <p>Let's say I have 2 different versions of my app installed in 2 different virtualenvironments. myapp v1.0 and myapp v2.0.</p>
  
  <p>Now I would like to compare those. The comparison is written in python itself. What would be the best way to do that? Let's assume I can run them separately and both write an output file, which I can compare later.</p>
  
  <p>One way to do that would be to write a bash script (that's what I have currently). I activate one virtualenv, run myapp v1.0, activate another virtualenv, run myapp v2.0. Later run a comparison module on those files. But I would like to add some more dynamics there (take some optional arguments etc) which would be easier with python.</p>
  
  <p>Edit:</p>
  
  <p>Currently I have something like that (a bash script):</p>
  
  <pre><code>source virtualenv1/bin/activate
  python my_script.py
  deactivate
  
  source virtualenv2/bin/activate
  python my_other_script.py
  deactivate
  
  python my_comparison_script.py
  </code></pre>
  
  <p>instead, I'd like to do only:</p>
  
  <pre><code>python my_comparison_script.py
  </code></pre>
  
  <p>and my scripts would be run inside this.</p>