Why it doesn't go ????

Gerhard Häring gh at ghaering.de
Fri Jun 6 09:29:46 EDT 2003


Panther wrote:
> ping.py is here, put it in where you exec script, in windows put it in
> c:\python2.2
> ftp://ftp.visi.com/users/mdc/ping.py
> 
> import os
> fd = os.popen('python ping.py 192.168.1.4', 'r')
> if fd.readline() == 'None':
>  print "I'don't ping ip"
> 
> Now can you try this and help me ???

I could, if I had the time and motivation. Which I haven't because 
there's a much better way:

ping.py being a Python module, why don't you simply import it and use it 
instead of going the complicated way via os.popen?

-- Gerhard






More information about the Python-list mailing list