Why are you importing string?
1) You don't seem to use it anywhere
2) Use string methods instead
Jacob
----- Original Message -----
Sent: Wednesday, September 28, 2005 7:35
AM
Subject: Re: [Tutor] script
question
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:
import ConfigParser, string, sys, os section = sys.argv[1] interface = sys.argv[3] INI=ConfigParser.ConfigParser() INI.read("c:\utils\interfaces.ini") interface_entries=[p for p in INI.options
(section)] interface_list=[INI.get(section, pw) for pw in interface_entries] for i in interface_list: if i == interface: os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet -n l17aesm1 forward red held " +
sys.argv[1] + " " + sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4]) 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.
- Show quoted text
-
_______________________________________________ Tutor maillist
-
Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
|
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor