<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
 
<br>One could use threads to avoid the select.
<p>Also, there is a ping/traceroute module written in python so one just
calls a method.  It was listed on Vaults of Parnassus at <A HREF="http://the-tech.mit.edu/~jeremy/python/">http://the-tech.mit.edu/~jeremy/python/</A>. 
It needs a bit of tweaking for Windows.
<p>Cameron Laird wrote:
<blockquote TYPE=CITE>In article <sZBU4.1751$%8.7965@news1.onlynews.com>,
<br>Greg Fortune <gfor_ewu@ispchannel.com> wrote:
<br>>Right now, I'm just sending the output of the ping to a text file
and then
<br>>reading it from there.
<br>>
<br>>os.system('ping -t 1 208.152.8.1 > convertor_temp.txt')
<br>>#Read input file and extract result
<br>>#Store result
<br>>
<br>>  That circumvents the need for the select.  The only reason
I've done this
<br>>is because the os.system call will not return the output from the
call (and
<br>>I'm very new to this language as well as "real-world" programming
<g>).  Is
<br>>there another way (possibly the select you mentioned) to get the output
from
<br>>a call back to the program?  I need to use this on both Linux
and Windows so
<br>>I can't use the UNIX specific commands module.
<br>>
<br>>Greg
<br>>
<br>>Cedric Adjih <adjih@crepuscule.com> wrote in message
<br>><a href="news:8ftqtk$25a$1@ites.inria.fr">news:8ftqtk$25a$1@ites.inria.fr</a>...
<br>>>
<br>>> You can use module time, function sleep:
<br>>>   time.sleep(1.1) # sleep 1.1 seconds
<br>>> Or if you are waiting for events or for a timeout, select
<br>>> will be helpful:
<br>>>   select.select([file desc list]..., timeOutInSeconds)
<br>>> For instance if you are waiting for a ping reply.
<br>>>
<br>>> -- Cedric
<br>>>
<br>>
<br>>
<p>What's the really cool, idiomatic way to multiplex in Python?
<br>I'm not happy with anything I do in this regard.
<p>First, I recognize this is far afield from Mr. Fortune's
<br>needs.  He's best served either by direct ICMP calls, or a
<br>simple
<br>  os.popen("ping -c 1 ...").read()
<br>which gives him all of what I understand he's after.  Mr.
<br>Fortune, let me know if it's not obvious how this answers
<br>your question, and I'll be more explicit.
<p>Suppose, though, that he really did need multiplexing.  Is
<br>there a tutorial I haven't noticed yet that models the Python
<br>way to process (let's call them) stream-based events?  We can
<br>put stuff in a thread, but that's a lot of mechanism; we can
<br>select, but, gosh, isn't that the low-level error-prone OS
<br>system-level programming Python's s'posed to transcend?  All
<br>the Python code I've seen in this area just "has too many
<br>notes".  It makes me think it's fragile.
<br>--
<p>Cameron Laird <claird@NeoSoft.com>
<br>Business:  <a href="http://www.Phaseit.net">http://www.Phaseit.net</a>
<br>Personal:  <a href="http://starbase.neosoft.com/~claird/home.html">http://starbase.neosoft.com/~claird/home.html</a></blockquote>
</html>