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.

HTH,
Senthil
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to