2

when I run the following python code in run mode, the response equals 0, when I run it in debug mode, the response is 127 and the failure /bin/sh: ping: command not found occured.

cmd = '-c 1'
host = 192.168.1.1
response = subprocess.call(f'ping {cmd} {host}, shell=True')

my launch.json looks like that:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

When using response = os.system(f'ping {cmd} {host}'), the response in run mode is 0 and in debug mode the response is 32512 and the failure sh: ping: command not found occured.

Can someone help me?

Erik Metz
  • 152
  • 1
  • 4

0 Answers0