[BangPypers] checking return status of 'ping' in windows

Senthil Kumaran senthil at uthcode.com
Sun Jan 22 14:35:42 CET 2012

On Sat, Jan 21, 2012 at 11:59:40PM +0530, Nikunj Badjatya wrote:
> How do I make my snippet to work as desired. i.e even if destination host
> is unreachable, 'status' should hold '1'  and hold '0' only when it gets
> reply from that ip address.??

You are doing it right with subprocess and you can extend the same.
Why don't you parse the output of the ping instead of the checking the
output status? When the interpretation of output status can be
ambiguous, as in your case, it is good to verify the content of the
output and assert it's suitability for the next action that you wish
to perform.


More information about the BangPypers mailing list