Replace subprocess.check_output with Popen

The check_output method does not exist in Python 2.6.
This change adds compatibility with RHEL 6.