print('Command is:', command)
op = subprocess.Popen(command, shell=True, stderr=subprocess.PIPE, stdout=
    subprocess.PIPE)
if op:
    output = str(op.stdout.read())
print('Output:', output)
Python sending command over a socket