check output from CalledProcessError

后端 未结 6 718
心在旅途
心在旅途 2020-12-02 15:11

I am using subprocess.check_output from pythons subprocess module to execute a ping command. Here is how I am doing it:

output = subprocess.check_output([\"p         


        
6条回答
  •  春和景丽
    2020-12-02 16:16

    In the list of arguments, each entry must be on its own. Using

    output = subprocess.check_output(["ping", "-c","2", "-W","2", "1.1.1.1"])
    

    should fix your problem.

提交回复
热议问题