pinging from within python

Harlin Seritt harlinseritt at yahoo.com
Sun Sep 18 02:54:33 EDT 2005


You can do the following:

import os

data = os.popen('ping machineName').read()
if 'request timed out' in data or 'unknown host' in data:
      Ping Failed Code
else:
      Ping Returned Something Good Code

This is the quickest and really most effective way to get it done IMO.

Harlin Seritt
Internet Villa: www.seritt.org




More information about the Python-list mailing list