title: How to debug subprocess call in Python/Django
body: <p>In my Python/Django code I call <code>gdalbuildvrt</code> process. This process should create a .VRT file, but it does not. In order to check it, I write the subprocess output to a debug file. This is how I do it:</p>
  
  <pre><code>process = subprocess.Popen(["gdalbuildvrt", mosaic, folder], stdout=subprocess.PIPE)
  stdout = process.communicate()[0]
  
  with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "debug.txt"), 'w') as file:
      file.write('{}'.format(stdout) + " -&gt; " + mosaic)
  </code></pre>
  
  <p>As a result I see this in debug.txt file:</p>
  
  <pre><code>b'0...10...20...30...40...50...60...70...80...90...100 - done.\n' -&gt; /var/www/vwrapper/accent/accent/layers/raw/mosaic.vrt
  </code></pre>
  
  <p>So, as you can see the first part of debug statement says, that it'ok:</p>
  
  <pre><code>0...10...20...30...40...50...60...70...80...90...100 - done.
  </code></pre>
  
  <p>And the second part says, that <code>/var/www/vwrapper/accent/accent/layers/raw/mosaic.vrt</code> should be created. However, when I go to the target folder and refresh it, I see no mosaic.vrt file there. So, what may be wrong with that and how can I fix it? I should add that on Windows machine it's 100% ok, but on CentOS it does not.</p>