Le seguenti 38 parole non sono state trovate nel dizionario di 1275 termini (includendo 1275 LocalSpellingWords) e sono evidenziate qui sotto:
Can   close   Codice   connect   display   dot   dotcon   dotoutput   draw   dumpolsrdot   else   Esempio   except   exit   exitonerror   host   if   import   main   name   olsrd   plugin   port   python   read   readfromdotplugin   return   stderr   sys   Telnet   telnetlib   timeout   to   Tpng   True   try   until   write  

Nascondi questo messaggio
Italiano English
Modifica History Actions

Script/dumpolsrdot

Questo script si utilizza con il dot_draw plugin di olsrd. Esempio:

./dumpolsrdot.py | dot -Tpng | display -

Codice:

   1 #!/usr/bin/env python
   2 
   3 #dumps the current OLSR topology in dot format (using the dot_draw plugin) to standard output
   4 
   5 import telnetlib
   6 import sys
   7 
   8 def readfromdotplugin(host='127.0.0.1',port='2004',timeout=120, exitonerror=True):
   9         try:
  10                 dotcon=telnetlib.Telnet(host,port)
  11         except:
  12                 sys.stderr.write("Error. Can't connect to %s:%s.\n" % (host,port))
  13                 if exitonerror:
  14                         sys.exit(2)
  15                 else:
  16                         return ""
  17         dotoutput=""
  18         dotoutput=dotcon.read_until('}',timeout)
  19         dotoutput+='\n'
  20         dotcon.close()
  21         return dotoutput
  22 #readfromdotplugin
  23 
  24 if __name__=="__main__":
  25         print readfromdotplugin()