Title: Message
Try this:
<code>
import os
pinginfo=os.popen("ping www.google.com")
#opens file object with output of the ping to google
print pinginfo.read(-1)
#reads the ping information from the abuv file object
pinginfo.close()
#closes the pinginfo object, as you would do for a standard file object
</code>
Note that pinginfo is actually a file object, and as such, you must treat it as you would any file you are reading to, readlines, read, etc.
HTH,
Brandon McGinty
 
 
 
 

----------
Feel free to contact me for technical support, or just to chat; I always have time to talk and help, and an open ear.
Email:[EMAIL PROTECTED]
Skype:brandon.mcginty
Msn:[EMAIL PROTECTED]
Aim:brandonmcginty (Not currently available.)
Cell:4802025790 (Weekends and nights only, please.)
"Kindness is a language that the deaf can hear and the blind can see."
Mark Twain

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of david brochu jr
Sent: Friday, April 14, 2006 5:04 PM
To: python-list@python.org
Subject: re: ping

Thanks,
 
Unfortunately substituting os.system with os.popen results in the output being:

<open file 'ping www.google.com
', mode 'r' at 0x009C4650>
<open file 'ping www.boston.com
', mode 'r' at 0x009C4650>
<open file 'ping www.espn.com
', mode 'r' at 0x009C4650>
<open file 'ping www.redsox.com
', mode 'r' at 0x009C4650>
 
instead of giving me the ping stats "pinging etc etc, packets sent 4 recienved 4 etc)
 
Any idea around this?
 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.1/312 - Release Date: 4/14/2006


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.1/312 - Release Date: 4/14/2006

-- 
http://mail.python.org/mailman/listinfo/python-list
  • RE: ping brandon.mcginty

Reply via email to