2013-01-14, 20:53
Hi Guys,
Just a little question. The code below should give me an error code. But it doesn't. It alwas comes with a 0, even if I change the IP address to one that doesn't exist on the network. Why is that?
I also tried ping.returncode. But nothing seems to work.
Did I make a typo? Or is there an other way around this?
Thanks
moh-san
Just a little question. The code below should give me an error code. But it doesn't. It alwas comes with a 0, even if I change the IP address to one that doesn't exist on the network. Why is that?
I also tried ping.returncode. But nothing seems to work.
Code:
import subprocess
ping = subprocess.Popen(["ping", "-c", "1", "10.0.0.123"])
return_code = ping.wait()
print return_code
Did I make a typo? Or is there an other way around this?
Thanks
moh-san