Why it doesn't go ????
gh at ghaering.de
Fri Jun 6 14:39:06 CEST 2003
> import os
> fd = os.popen('python ping.py 192.168.1.4', 'r')
> if fd.readline() == 'None':
> print "I'don't ping ip"
ping.py? Which ping.py are you talking about?
Or do you want to invoke the system command 'ping' instead? If you want
to invoke the system command, this would look like:
fd = os.popen('ping 192.168.1.4', 'r')
No python and no .py.
Also it's hard for me to believe this program will actually print a line
To invoke the system 'ping', here's a suggestion:
output = commands.getoutput("ping -c 1 192.168.1.4")
Linux ping has a -c parameter for how often to ping. Similarly -n on
Windows. Linux ping will ping until killed by default.
More information about the Python-list