The key to this problem is when you say:
But when I ran this printed cmd in bash ...
Popen bash, , ββ /bin/sh, echo bash. , bash, , :
$ echo -n -e '\x61' | md5sum
0cc175b9c0f1b6a831c399e269772661 -
/bin/sh, :
$ echo -n -e '\x61' | md5sum
20b5b5ca564e98e1fadc00ebdc82ed63 -
, /bin/sh -e escape- \x.
python, , /bin/sh:
>>> cmd = "echo -n -e '\\x61' | md5sum"
>>> event = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
>>> print event.communicate()
('20b5b5ca564e98e1fadc00ebdc82ed63 -\n', None)