[Tutor] Executing a command from a specific directory

Steve Willoughby steve at alchemy.com
Wed Sep 16 20:43:35 CEST 2009


> Ansuman Dash wrote:
> >Now I am trying to validate that the command is executed successfully.
> >I have written following script to validate the log file which is created
> >after running the command.

Notice what's happening here:

> >            for line in f.readlines():
> >                a=line

This sets a to EACH line from the file, overwriting
the previous one.  What you end up with after that
executes is a holding the LAST line in the file.

> >            if "Request timed out.." not in a:
> >                print("Ping is not successful.")
> >                pLogger.info("Ping is not successful.")

Also... this looks backwards.  If "Request timed out.." is NOT found
then the ping was NOT successful?

-- 
Steve Willoughby    |  Using billion-dollar satellites
steve at alchemy.com   |  to hunt for Tupperware.


More information about the Tutor mailing list