title: Want to resize terminal windows in python, working but not quite right
body: <p>I'm attempted to resize the terminal window on launch of a python script to ensure the display will be static size. It's working but not quite what I expected. I've tried a few methods:</p>
  
  <pre><code>import sys
  sys.stdout.write("\x1b[8;40;120t")
  </code></pre>
  
  <p>and </p>
  
  <pre><code>import subprocess
  subprocess.call(["echo","-e","\x1b[8;40;120t"])
  </code></pre>
  
  <p>and even just</p>
  
  <pre><code>print "\x1b[8;40;80t"
  </code></pre>
  
  <p>They all work and resize the real terminal. However, if my terminal is, let's say 25x80 to start, the script starts, it resizes, then exits. It will not execute the rest of the script. I wrapped it in a try/Except and nothing is thrown. Nothing in the syslogs and python -v script.py shows nothing odd. If I execute the script again or at a term size of 40x120 (my target size)..the script runs just fine. Why is exeecuting the ANSI escape exiting python? Furthermore if I run this interactively it works with no issues.
  Using Python 2.6.6.</p>