[Tutor] My last

S A buc40@bemail.org
Wed, 4 Sep 2002 10:34:50 -0700


I would like to add, please stay with one thread. You are making things a little more confusing for everyone by jumping to different threads. Reply only to the list and the authors of the email you are responding to. This will ensure that everyone on the list can follow the same thread and see what has been developed so far.

What you have so far in your program is doing exactly what you have written. It is not however doing what you wish to accomplish for a couple of different reasons, the first being that your programming logic is wrong here. To begin solving the problem let's look at the issues:
1. You want a script that runs through a PPP.log file and extracts info.
2. One piece of info you want is connection time for an IP address.(I assume it is tha IP address you are assigned?)
3. You want to know how many octets are passed in/out during this connection.
4. You then wish to take this extracted info and print it out in a formatted print?

Are these correct? Is there anything else you wish to extract from the file?
Danny is correct here. Start with something that works and then build on it. Answer my two questions and I will continue to direct you to the solution. Everyone else please jump in and correct my mistakes also, since I'm not an expert.

Thanks.
SA
> Danny Yoo <dyoo@hkn.eecs.berkeley.edu> Morne <fromclay@maxitec.co.za>cc: python tutor <tutor@python.org>
> Re: [Tutor] My lastDate: Wed, 4 Sep 2002 01:14:16 -0700 (PDT)
>
>
>
>On Wed, 4 Sep 2002, Morne wrote:
>
>> Could someone please help me with this?
>>
>> Im really new to any kind of programming and the people at python.org
>> return my messages in some other code :not python(lol)The people there
>> are cool I just dont seem to understand there answers.  If posible would
>> you be able to answer in detail.
>
>When we learn from each other, things have to go in two directions: you
>need to tell us exactly where we start sounding ludicrous.  Many of us
>have done programming so long that things are beginning to look "obvious"
>to us.  Beware us when that happens.  *grin*
>
>We know that, all too easily, things that seem "obvious" aren't obvious at
>all. The thing is that we can't tell when we start sounding crazy, so
>you've got to wave your hands a bit wildly to bring us back down to Earth.
>
>When you hear a confusing answer, bring it up; perhaps someone here can
>put a light on it to make it less mysterious.
>
>
>
>> is it wrong of me to send the ppp.log file to just anyone?
>
>It's not "wrong" at all, and it's often really helpful.  If it is a bit
>long, then it might be better to post it somewhere on the web and send us
>an url instead, to save bandwidth.
>
>An alternative is to just take a few lines of log that cover all the cases
>that are being tested for (connections, layers, errors, etc.)  Maybe
>around 12 lines or so is good.  It also helps because a smaller case is
>easier to check by hand.
>
>
>I've taken a look at your program: I don't see anything obviously wrong
>yet, but you may find it easier if you try for a slightly simpler program
>that works, before going after the whole problem.  How about something
>like this?
>
>###
>def getStuff(file):
>    ppplist = file.readlines()
>    for line in ppplist:
>        print "I am looking at line", line
>        if string.file(line, "connect time") >= 0:
>            print "found close"
>            connectSecs = secondsMatcher.search(line).group(1)
>            print "Connected for", connectSecs
>
>def main():
>    f = open("C:/my documents/ppp.log", "r")
>    getStuff(f)
>###
>
>That is, just pay attention to 'connect time' lines in your program for
>now.  I've also added a small "I am looking at blah" print statement, so
>you can trace out what's happening in the program.
>
>
>Does this do anything useful with your log?  Do you get any errors, or
>does it skip all your log lines without doing anything?  Let's get
>something working first: we can always add more to a working program.
>It's much harder to get a whole, fully-working program at first go: we
>often need to build toward it.
>
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor



"I can do everything on my Mac that I used to do on my PC, plus alot more ..."

-Me

------------------------------------------------------------
Free, BeOS-friendly email accounts: http://BeMail.org/
BeOS News and Community: http://www.BeGroovy.com/


---------------------------------------------------------------------
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
---------------------------------------------------------------------