<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Why are you importing string?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>1) You don't seem to use it anywhere</FONT></DIV>
<DIV><FONT size=2>2) Use string methods instead</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Jacob</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=challman@gmail.com href="mailto:challman@gmail.com">Chris Hallman</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=tutor@python.org
href="mailto:tutor@python.org">tutor@python.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, September 28, 2005 7:35
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Tutor] script
question</DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><BR></DIV>Thanks for all the
input!!! I really appreciate it. I need to post a correction to my script.
What I sent was an early version. I made a few minor modifications:<BR><BR><PRE>import ConfigParser, string, sys, os<BR>section = sys.argv[1]<BR>interface = sys.argv[3]<BR>INI=ConfigParser.ConfigParser()<BR>INI.read("c:\utils\interfaces.ini")<BR>interface_entries=[p for p in INI.options
<BR>(section)]<BR>interface_list=[INI.get(section, pw) for pw in interface_entries]<BR>for i in interface_list:<BR>        if i == interface:<BR>                os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet -n l17aesm1 forward red held " +
<BR><SPAN class=q>sys.argv[1] + " " + sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4])</SPAN></PRE><BR>I've
researched what you all have suggested and I may need to switch to reading the
ini file line by line or using a different file parser. The ini file is only
100 lines long now, but will likely grow to 500 line and maybe to 4000 lines.
To give you a better background of what I'm doing with this script, it's
running on a network management system that receives traps. After some
processing of the raw trap, messages get sent to this script for further
processing. These messages are for interface down traps from routers and
switches in our network. I use this script to mitigate the number of interface
down messages on our console. I need to do this because we do not need to know
when every port has gone down (i.e. user ports). This script searches the ini
file for a device name match. Once it has found a match and if the interface
matches as well, I need to message forwarded to the console (the Windows
command). If no matching device or interface is found, then the script can
just exit.
<DIV class=ea><SPAN id=e_1069cb9e2e3d18fd_3>- Show quoted text
-</SPAN></DIV><BR><BR>
<DIV><SPAN class=gmail_quote>On 9/26/05, <B class=gmail_sendername>Kent
Johnson</B> <<A href="mailto:kent37@tds.net">kent37@tds.net</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Kent
Johnson wrote:<BR>> *TEST FIRST* Don't optimize until you know it is too
slow and you<BR>> have a test case that you can time to see if your
'optimizations' are<BR>> making it faster.<BR><BR>Pardon my shouting :-)
<BR><BR>Kent<BR><BR>_______________________________________________<BR>Tutor
maillist - <A
href="mailto:Tutor@python.org">Tutor@python.org</A><BR><A
href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor
</A><BR></BLOCKQUOTE></DIV><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Tutor maillist
-
Tutor@python.org<BR>http://mail.python.org/mailman/listinfo/tutor<BR></BLOCKQUOTE></BODY></HTML>