try:
    print(subprocess.check_output(['ping', '-n', '2', '-w', '2', '1.1.1.1']))
except subprocess.CalledProcessError as e:
    print('Ping stdout output:\n', e.output)
проверить вывод из CalledProcessError