title: Use subprocess to check md5sum
body: <p>I am trying to check the md5sum of a software installed in my system. I will first explain the environment and then I will explain the problem. There is a directory /home/software. in this directory there multiple folders like software1, software2 and so on . in each of these folders there is a folder (say folder1) which contains a  check*.md5 file(check123.md5). Its the contents of this file that I am trying to read. </p>
  
  <p>Eg:</p>
  
  <pre><code>&gt;&gt;cd /home/software/software1
  &gt;&gt;md5sum -c  folder1/check*.md5
  </code></pre>
  
  <p>When I try the above two commands in linux command line, I get the output.
  I am trying to write a script in python. So initially i used os.system and again it worked. But now my requirements are such that I have to use subprocess. But it does not work anymore. </p>
  
  <p>My code can be simulated even in the python command line.</p>
  
  <pre><code> import subprocess, os
   os.chdir(/home/software/software1)
   var = "md5sum -c  folder1/check*.md5"
   vars = shlex.split(var)
   p1 = subprocess.Popen(vars, stdout = open ("/tmp/test.txt", "a"))
  </code></pre>
  
  <p>The output is as follows:  md5sum: folder1/check*.md5: No such file or directory.</p>
  
  <p>Now I realise that this error comes only if I am not in the proper directory. But a os.cwd() showed that I am in the correct directory. </p>
  
  <p>Does anyone know what the problem is?</p>