Re: [Tutor] script question

2005-10-18 Thread Chris Hallman
Here is my latest revision, which works very well. # This Python script was written to forward interface down messages # to ESM1. If the incoming arguements match the interface file # (c:\utils\interface.ini) then the message is forwarded. # # Author: tcdh # Date: 09/22/05 # Modified:

Re: [Tutor] script question

2005-09-30 Thread Kent Johnson
Chris Hallman wrote: 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: You don't seem to have incorporated any of the suggestions that you have received! I doubt that a

Re: [Tutor] script question

2005-09-29 Thread Jacob S.
Why are you importing string? 1) You don't seem to use it anywhere 2) Use string methods instead Jacob - Original Message - From: Chris Hallman To: tutor@python.org Sent: Wednesday, September 28, 2005 7:35 AM Subject: Re: [Tutor] script

Re: [Tutor] script question

2005-09-28 Thread Chris Hallman
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, ossection = sys.argv[1]interface =

Re: [Tutor] script question

2005-09-28 Thread Andrew P
Have you benchmarked it yet? 4000 lines isn't very many, even for an older machine. Starting the Python interpreter usually takes most of the time with simple scripts like this. Honestly, benchmark :) You might find it easier to do:: interface_list = INI.items(section)for i in interface_list:

Re: [Tutor] script question

2005-09-26 Thread R. Alan Monroe
for i in passwordlist: if i == port: os.system(d:\\tnd\\bin\\cawto.exe -cat NetNet + sys.argv[1] + + sys.argv[2] + + sys.argv[3] + + sys.argv[4]) If you don't have duplicates in your list, a break after the os.system line might help, because once you've found what you're

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Chris Hallman wrote: Here is the script: import ConfigParser, string, sys section = sys.argv[1] port = sys.argv[3] INI=ConfigParser.ConfigParser() INI.read(interfaces.ini) passwordentries=[p for p in INI.options(section)] passwordlist=[INI.get(section, pw) for pw in passwordentries]

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Kent Johnson wrote: *TEST FIRST* Don't optimize until you know it is too slow and you have a test case that you can time to see if your 'optimizations' are making it faster. Pardon my shouting :-) Kent ___ Tutor maillist - Tutor@python.org