title: Run subprocess at high prio
body: <p>I need to run a jar file from my python script that has to meet some realtime requirements (it's a programmer).</p>
  
  <p>What I currently do is</p>
  
  <pre><code>import subprocess
  
  process = subprocess.Popen(shlex.split("java programmer.jar"), stdout=subprocess.PIPE)
  </code></pre>
  
  <p>but the programmer stalls on a regular basis what doesn't happen if I start it by hand using <code>start /high java programmer.jar</code>. So I'd like to somehow also set the priority of the subprocess directly from my python script.
  But if use the command above, I get a <code>FileNotFoundError</code>, so Google told me that I have to use the <code>shell=True</code> flag. That solved my problem but created a new one as I now have my jar running in another shell so I cannot parse the <code>stdout</code> anymore what I have to do to take some actions.</p>
  
  <p>So is there a way to either run <code>subprocess</code> directly at a higher priority or to redirect the console output of the shell it creates when I run </p>
  
  <pre><code>process = subprocess.Popen(shlex.split("java programmer.jar"), stdout=subprocess.PIPE, shell=True)
  </code></pre>
  
  <p>This has to run on Windows</p>