On Mon, 29 Feb 2016 07:13 pm, Ganesh Pal wrote:
> def run_cmd_and_verify(cmd, timeout=1000):
> try:
> out, err, ret = run(cmd, timeout=timeout)
> assert ret ==0,"ERROR (ret %d): " \
> " \nout: %s\nerr: %s\n" % (ret, out, err)
Do not use assert for error checki
On Tue, 1 Mar 2016 04:38 am, Chris Angelico wrote:
> On Tue, Mar 1, 2016 at 4:34 AM, Ganesh Pal wrote:
>> On Mon, Feb 29, 2016 at 10:10 PM, Dennis Lee Bieber
>> wrote:
>>
>>> Ask yourself: Will my program still work if I remove all the
>>> assert
>>> statements. If the answer is
> I have tried down the code to
Read "I have tried down the code to " as I have trimmed down the code as below
Ganesh
--
https://mail.python.org/mailman/listinfo/python-list
> No, Dennis was correct. You should assume that "assert" can
> potentially be replaced with "pass" and your program will continue to
> work.
Thanks Chris for clarifying Dennis point of view ,
>>try:
>>if not run_cmd_and_verify(cmd, timeout=3600):
>
> Since your vers
On Tue, Mar 1, 2016 at 4:34 AM, Ganesh Pal wrote:
> On Mon, Feb 29, 2016 at 10:10 PM, Dennis Lee Bieber
> wrote:
>
>> Ask yourself: Will my program still work if I remove all the assert
>> statements. If the answer is "No", then you should not be using an assert.
>
> You meant if the answ
On Mon, Feb 29, 2016 at 10:10 PM, Dennis Lee Bieber
wrote:
> Ask yourself: Will my program still work if I remove all the assert
> statements. If the answer is "No", then you should not be using an assert.
You meant if the answer is "NO" then I should be using asset ?
> Can your
Iam really sorry , I will have to resend my question again , because
the earlier post had mistakes and formatting was bad , so apologies
for top posting will try to avoid such mistakes in future.
Iam on python 2.6 and Linux , need your suggestion on the usage of try
and except in this program
#
Iam on python 2.6 and Linux , need your suggestion on the usage of try
and except in this program and
Modified code:
#!/usr/bin/env python
"""
"""
import os
import shlex
import subprocess
import sys
import time
import logging
import run
import pdb
def run_cmd_and_verify(cmd, timeo