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.
Eg:
>>cd /home/software/software1
>>md5sum -c folder1/check*.md5
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.
My code can be simulated even in the python command line.
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"))
The output is as follows: md5sum: folder1/check*.md5: No such file or directory.
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.
Does anyone know what the problem is?