A few code critiques:<br> -  Your code is not very help friendly because it can not be run, so I have to deadlist debug it.<br> -  There are various syntax errors in the code:<br>    - for example: file is not defined when you invoke tail(file)<br>

 -  You are overshadowing a built-in type 'file' by that name, which is confusing. PEP 8 states that if you want to use a keyword, the practice is to put an underscore after it. So, it should become file_<br> -  Getopt is very old and should not be used. You should use the better, readable, optparse<br>

 -  That while loop will consume 99% CPU because of the infinite loop<br> -  line = file.readline() is guaranteed to return a newline OR an empty string ONLY when an EOF is encountered since you're not specifying the optional maximum read byte size. This means that all your characters are strings. So, why do you explicitly convert each character to a string and separate each character by a space? (line 18)<br>

 - Line 19 will always return 0 because of line 18<br> - Line 19->22 are completely redundant, since readline is guaranteed to give you ONE line. You should just do if "uccess" in logString: ...<br><br>Hope this helps,<br clear="all">

mahmoud mack abdelkader<br><a href="http://blog.mahmoudimus.com/">http://blog.mahmoudimus.com/</a><br><br>
<br><br><div class="gmail_quote">On Fri, Jul 17, 2009 at 5:58 PM, LoD MoD <span dir="ltr"><<a href="mailto:lodmod.dod@gmail.com">lodmod.dod@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I am trying to fabricate a logwatch-type script in Python and I'm having some trouble.<div>What happens with the following code is that it prints to the screen but the if condition on line 22 never gets executed.</div>


<div><br></div><div><a href="http://pastie.org/549975" target="_blank">http://pastie.org/549975</a><br></div><div><br></div><div>Any suggestions are appreciated.</div>
<br>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br></blockquote></div><br>